07-19-2019 01:10 AM
Hello fellow TS enthusiasts,
I have a few clarifications regarding the TS api. My requirement has it that I have to design a simple TS api interface as a .net library which will take a sequence file path as a parameter and execute the test and return whether the tests have passed. However, I have a few challenges with activeX as AX runs properly in windows forms as a UI control which is basically branched out and running in parallel with the UI through connectcommand. I cannot set the ocx state as well because of the class library not being a windows form type (Then again, I am not sure if it even makes sense to make my class library inherit from windows forms).
Here is a bit of code:
//Init axApplicationMgr = new NationalInstruments.TestStand.Interop.UI.Ax.AxApplicationMgr(); axSequenceFileViewMgr = new NationalInstruments.TestStand.Interop.UI.Ax.AxSequenceFileViewMgr(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestStandExecutorApi)); ((System.ComponentModel.ISupportInitialize)(this.axApplicationMgr)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axSequenceFileViewMgr)).BeginInit();
this.axApplicationMgr.Enabled = true; this.axApplicationMgr.Name = "axApplicationMgr"; ((System.ComponentModel.ISupportInitialize)(this.axApplicationMgr)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axSequenceFileViewMgr)).EndInit();
axApplicationMgr.Start(); axApplicationMgr.OpenSequenceFile(path); axSequenceFileViewMgr.GetCommand(CommandKinds.CommandKind_RunCurrentSequence).Execute(true);
Am I doing something or everything wrong?
Kindest regards,
a dumfounded fellow programmer.
Solved! Go to Solution.
07-22-2019 04:26 PM
If those are your requirements then your work is already done. Take the C# UI that ships with TestStand and call it from the command line and use flags. Technically you have all the source code for that UI.
https://zone.ni.com/reference/en-XX/help/370052W-01/tsfundamentals/infotopics/startup_opt/
Also this:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P9lvSAC
Hope this helps,
07-23-2019 05:06 AM
Just for the benefit of the community, I managed to get everything working as I needed. Thanks for the pointers Jiggawax.
I could instantiate the activeX controls using .createControl() to forcibly create an instance and then use the getengine() method to get execution engine and then, pass the sequence file and model for the execution to create an instance of the execution.