- changed status to resolved
Tester.Winform codes error
Issue #8
resolved
The method LoadSourceCaps() in your TestForm class, should the if statement code
if (groupDepth.Enabled = caps.Contains(CapabilityId.ICapPixelType))
be
if (groupDepth.Enabled == caps.Contains(CapabilityId.ICapPixelType))
? Same with other if statements in the same method.
Comments (4)
-
repo owner -
reporter The single equal ("=") means assign, and the double equal ("==") means compare. I think the if statement should use the double equal ("=="), otherwise the project will show compile error. Am I right?
-
repo owner Assign is correct. The control needs to be enabled/disabled with cap.Contains() check first and then the condition tests for that result. Equality means the groupDepth control somehow already knows the result, which is not the case.
This is probably clearer than the example before
groupDepth.Enabled = caps.Contains(CapabilityId.ICapPixelType); if (groupDepth.Enabled) ... // is equivalent to if (groupDepth.Enabled = caps.Contains(CapabilityId.ICapPixelType))
-
reporter I see. Thanks!
- Log in to comment
No this is by design. It's enabling/disabling the control first and using that result in the if condition next.
It's the equivalent of these 2 lines