09-12-2013 06:01 PM
I thought I am an experienced C# developer, but when I opened the TestStand Simple User Interface in the C# solution in the following folder, I was lost.
\National Instruments\TestStand 4.2.1\UserInterfaces\Simple\CSharp
I have read through Chapter 9 (Create Custom User Interfaces) in NI TestStand Reference Manual. It helps me a little bit, but I still don't quite understand how the C# code works.
For example, in design view (refer to screen-shot 1), the button "ENTRY POINT1" has no event handle associated with it. When I ran the program, this caption of this button changed to "Test UUTs" (refer to screen-shot 2). And after I loaded a sequence file, and click this button "Test UUTs", the sequence carried out its tasks happilly just like ran from the Sequence Editor. How did this magic happen?
I appreciate If someone can point me a step by step tutorial to explain the mechanism more friendly rather than the description in the reference manual (that must be for advanced users, unfortunately, I am not for now).
Thanks,
Leo
Screen-shot 1
Screen-shot 2
09-13-2013 02:37 AM
Leo,
the reason is that this button is no C# button, but an ActiveX container containing a specific TestStand component (type: "Visible control 'Button'").
Therefore, this container already encapsulated a lot of functionality, which is "running in parallel to your C# application".
In order to make your UI work correctly with the container, you have to "connect" the control to a specific function. This is done in the code line:
axSequenceFileViewMgr.ConnectCommand(axEntryPoint1Button, CommandKinds.CommandKind_ExecutionEntryPoints_Set, 0, CommandConnectionOptions.CommandConnection_NoOptions);
Well, that's all you need to make this button control to work as a "start button for your sequence execution" (including labling).
Norbert
09-13-2013 05:19 PM
Hi Norbert,
Thanks for your reply.The code makes more sense now
So for "Test UUTs", the axEntryPoint1Button control is connected to execution entry point 0. Then the default caption for this button is "Test UUTs".
With the same logic, for "Single Pass", the axEntryPoint2Button control is connected to execution entry 1 as shown below:
axSequenceFileViewMgr.ConnectCommand(axEntryPoint2Button, CommandKinds.CommandKind_ExecutionEntryPoints_Set, 1, CommandConnectionOptions.CommandConnection_NoOptions);
I have two questions:
1. Is there a way to customize the button caption from "Test UUTs" to something like "Start Test"? Since I may simply the interface for factory by removing other buttons like "Single Pass", it is more conventional for us to just show "Start".
2. Is there a document to describe the classes and methods (like axSequenceFileViewMgr, ConnectCommand) in details? I cannot find them in the TestStand Reference Manual, nor by searching the Help (F1) installed with TestStand.
Thanks,
Leo
09-16-2013 02:17 AM
Leo,
the string which is displayed as button text is read from the language files. These are ini-files part of TS. You can translate or modify those strings. But if you do so, please copy the original language files (english) and create another "language" in the TS folders:
<TestStand>/components/language/english
to
<TestStand Public>/components/language/<YourLanguage>
The documentation of this is part of TS help, but it is not very obvious which is important for you or not.
I recommend you to ask your local NI branch for some kind of consulting (most likely liable to costs) but this should be the most effective way to get started with this topic.
Otherwise, the most essential basics for this is covered in the TS 2: Customization class from NI.
hope this helps,
Norbert
09-16-2013 01:47 PM
Norbert,
You are right. The description of the C# classes can be found in the Help file. Just in case others are wondering about the same thing as I did, you can search the details about a method by removing the "ax" prefix.
For example, if you want to know details about the method "ConnectCommand" in "UI.Ax.AxSequenceFileViewMgr" as shown below:
private NationalInstruments.TestStand.Interop.UI.Ax.AxSequenceFileViewMgr axSequenceFileViewMgr;
axSequenceFileViewMgr.ConnectCommand(axEntryPoint1Button, CommandKinds.CommandKind_ExecutionEntryPoints_Set, 0, CommandConnectionOptions.CommandConnection_NoOptions);
Search for "SequenceFileViewMgr.ConnectCommand" (with ax) in the Help (.chm) file as shown in the following screen-shot.
Thanks,
Leo