05-07-2010 08:31 AM
Hi - I am trying to use the .net button instead of the teststand activex. Is there any way that I can connect the execution command "single pass" of teststand to a regular .net button?
I did try the following codes but its throwing me an error:
axExecutionViewMgr.GetCommand(CommandKinds.CommandKind_RunEntryPoint,1);
and..
axExecutionViewMgr.GetCommand(CommandKinds.CommandKind_ExecutionEntryPoints_Set,1);
BOTH of the codes,throw COMException error, index out of range.
Any ideas???
Solved! Go to Solution.
05-07-2010 09:56 AM - edited 05-07-2010 09:57 AM
In the Sequence Properties for both the Single Pass and Test UUTs entry points, they are not configured to appear for execution windows because they start new executions, rather than operate on existing executions. It is likely that your model doesn't have any entry points that apply to existing executions, thus the index out of range error.
You need to get the command via the SequenceFileViewMgr instead.
05-07-2010 10:08 AM
I tried your suggestion.
axSequenceFileViewMgr.GetCommand(CommandKinds.CommandKind_ExecutionEntryPoints_Set, 1);
Didn't throw any error but, it didn't do anything. What am I missing?
05-07-2010 10:13 AM
I think I got it.
I added the ff codes:
Command command = axSequenceFileViewMgr.GetCommand(CommandKinds.CommandKind_ExecutionEntryPoints_Set, 1);
command.Execute(true);
..so far so good.. and let me know if there is anything I should watch for by going on this route.
Thanks!
05-07-2010 10:13 AM - edited 05-07-2010 10:23 AM
Other thing to consider:
The returned Command object has properties that you might want to apply to your .net button, such as Visible and Enabled. You might even want to use the label that Command.GetDisplayName returns.
The state of these properties might change, such as when you switch between having a file loaded or not, or if you switch process models. In general, determining what are all the changes that could effect the properties of a specific Command is not trivial.
The easiest way to determine if a change has occurred that would warrant updating your .net control's properties from the Command is to connect the exact same command to a hidden TestStand button and handle that button's ConnectionActivity event. In the event, you would get the relevant Command properties and re-apply them to your corresponding .net button.
05-07-2010 10:39 AM
Very good information. Thanks James!