static void Main(string[] args) { Engine engine; PropertyObjectFile configFile = null; PropertyObject configFileData = null; PropertyObject configFileTypeGroups = null; PropertyObject niVeriStandObj = null; PropertyObject sequenceLevelCommandsSpacesObj = null; PropertyObject sequenceLevelCommandsObj = null; PropertyObject advancedObj = null; PropertyObject guiObj = null; PropertyObject modelsObj = null; PropertyObject stimulusProfileObj = null; PropertyObject alarmsObj = null; PropertyObject channelFaultSpacesObj = null; PropertyObject veristandTestsObj = null; PropertyObject channelsObj = null; PropertyObject dataLoggingObj = null; PropertyObject rtSequenceObj = null; PropertyObject llProjectControlObj = null; PropertyObject llStimulusProfileControlObj = null; PropertyObject llRTSequenceControlObj = null; PropertyObject silentObj = null; PropertyObject channelFaultObj = null; PropertyObject stimulusProfileSpacesObj = null; PropertyObject loggingObj = null; System.Windows.Forms.Timer GCTimer = null; //List an array of the TypeGroups from TestExec.ini you would like to remove string[] typeGroupNames = { "[\"NI VeriStand\"]", "[\"Sequence Level Commands\"]", "[\"SequenceLevelCommands\"]", "[\"Advanced\"]", "[\"GUI\"]", "[\"Models\"]", "[\"StimulusProfile\"]", "[\"Alarms\"]", "[\"Channel Fault\"]", "[\"VeriStand Tests\"]", "[\"Channels\"]", "[\"Data Logging\"]", "[\"RT Sequence\"]", "[\"Low-Level Project Control\"]", "[\"Low-Level Stimulus Profile Control\"]", "[\"Low-Level RT Sequence Control\"]", "[\"Silent\"]", "[\"ChannelFault\"]", "[\"Stimulus Profile\"]", "[\"Logging\"]" }; //List the corresponding TypeGroup PropertyObjects in the same order as the TypeGroup names array above PropertyObject[] typeGroupObjs = { niVeriStandObj, sequenceLevelCommandsSpacesObj, sequenceLevelCommandsObj, advancedObj, guiObj, modelsObj, stimulusProfileObj, alarmsObj, channelFaultSpacesObj, veristandTestsObj, channelsObj, dataLoggingObj, rtSequenceObj, llProjectControlObj, llStimulusProfileControlObj, llRTSequenceControlObj, silentObj, channelFaultObj, stimulusProfileSpacesObj, loggingObj }; //Add ApplicationManager to hidden form to allow this Console Application to shutdown the Engine without seeing PropertyObject reference leaks. //The ApplicationManager allows us to receive a UI_Msg when everything is finished shutting down System.Windows.Forms.Form hiddenForm = new System.Windows.Forms.Form(); NationalInstruments.TestStand.Interop.UI.Ax.AxApplicationMgr appMgr = new NationalInstruments.TestStand.Interop.UI.Ax.AxApplicationMgr(); ((System.ComponentModel.ISupportInitialize)(appMgr)).BeginInit(); hiddenForm.Controls.Add(appMgr); ((System.ComponentModel.ISupportInitialize)(appMgr)).EndInit(); // If this UI is running in a CLR other than the one TestStand uses, // then it needs its own GCTimer for that version of the CLR. If it's running in the // same CLR as TestStand then the engine's gctimer enabled by the ApplicationMgr // is sufficient. See the API help for Engine.DotNetGarbageCollectionInterval for more details. if (System.Environment.Version.ToString() != appMgr.GetEngine().DotNetCLRVersion) { GCTimer.Enabled = true; } appMgr.LoginOnStart = false; //Do not show the TestStand Login dialog because this is a standalone tool, not a UI. appMgr.Start(); engine = appMgr.GetEngine(); //Get the TestStand configFile = engine.ConfigFile; if (configFile.ReadFile(TypeConflictHandlerTypes.ConflictHandler_Error)) { configFileData = configFile.Data; try { configFileTypeGroups = configFileData.GetPropertyObject("TypeGroups", 0); if (configFileTypeGroups.Exists("", 0)) { for (int i = 0; i < typeGroupNames.Length; i++) { try { typeGroupObjs[i] = configFileData.GetPropertyObject("TypeGroups" + typeGroupNames[i], 0); if (typeGroupObjs[i].Exists("", 0)) { int n = configFileTypeGroups.GetArrayOffset("", 0, typeGroupNames[i]); configFileTypeGroups.DeleteElements(n, 1, 0); } } catch (System.Runtime.InteropServices.COMException ex) { //do nothing } catch (System.NullReferenceException ex) { //do nothing } catch (System.IndexOutOfRangeException ex) { //do nothing } } } } catch (System.Runtime.InteropServices.COMException ex) { //do nothing } catch (System.NullReferenceException ex) { //do nothing } catch (System.IndexOutOfRangeException ex) { //do nothing } } try { configFile.IncChangeCount(); configFile.SaveFileIfModified(false); } catch (System.Runtime.InteropServices.COMException ex) { //do nothing } catch (System.NullReferenceException ex) { //do nothing } catch (System.IndexOutOfRangeException ex) { //do nothing } finally { if (engine != null) { engine.ShutDown(false); while (appMgr.IsShuttingDown == true) { //Wait until ApplicationManager is finished shutdown } engine.ShutDown(true); } } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.axApplicationMgr = new NationalInstruments.TestStand.Interop.UI.Ax.AxApplicationMgr(); this.axFilesComboBox = new NationalInstruments.TestStand.Interop.UI.Ax.AxComboBox(); this.axSequencesComboBox = new NationalInstruments.TestStand.Interop.UI.Ax.AxComboBox(); this.axOpenFileButton = new NationalInstruments.TestStand.Interop.UI.Ax.AxButton(); this.axCloseFileButton = new NationalInstruments.TestStand.Interop.UI.Ax.AxButton(); this.GCTimer = new System.Windows.Forms.Timer(this.components); this.axExecutionViewMgr = new NationalInstruments.TestStand.Interop.UI.Ax.AxExecutionViewMgr(); this.axSequenceFileViewMgr = new NationalInstruments.TestStand.Interop.UI.Ax.AxSequenceFileViewMgr(); this.axEntryPoint1Button = new NationalInstruments.TestStand.Interop.UI.Ax.AxButton(); this.axEntryPoint2Button = new NationalInstruments.TestStand.Interop.UI.Ax.AxButton(); this.axRunSelectedButton = new NationalInstruments.TestStand.Interop.UI.Ax.AxButton(); this.axExecutionsComboBox = new NationalInstruments.TestStand.Interop.UI.Ax.AxComboBox(); this.axCloseExecutionButton = new NationalInstruments.TestStand.Interop.UI.Ax.AxButton(); this.sequenceFileLabel = new System.Windows.Forms.Label(); this.sequenceLabel = new System.Windows.Forms.Label(); this.executionLabel = new System.Windows.Forms.Label(); this.axSequenceView = new NationalInstruments.TestStand.Interop.UI.Ax.AxSequenceView(); this.axReportView = new NationalInstruments.TestStand.Interop.UI.Ax.AxReportView(); this.axBreakResumeButton = new NationalInstruments.TestStand.Interop.UI.Ax.AxButton(); this.axTerminateRestartButton = new NationalInstruments.TestStand.Interop.UI.Ax.AxButton(); this.axLoginLogoutButton = new NationalInstruments.TestStand.Interop.UI.Ax.AxButton(); this.axExitButton = new NationalInstruments.TestStand.Interop.UI.Ax.AxButton(); this.axTerminateAllButton = new NationalInstruments.TestStand.Interop.UI.Ax.AxButton(); ((System.ComponentModel.ISupportInitialize)(this.axApplicationMgr)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axFilesComboBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axSequencesComboBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axOpenFileButton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axCloseFileButton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axExecutionViewMgr)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axSequenceFileViewMgr)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axEntryPoint1Button)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axEntryPoint2Button)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axRunSelectedButton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axExecutionsComboBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axCloseExecutionButton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axSequenceView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axReportView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axBreakResumeButton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axTerminateRestartButton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axLoginLogoutButton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axExitButton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axTerminateAllButton)).BeginInit(); this.SuspendLayout(); // // axApplicationMgr // this.axApplicationMgr.Enabled = true; this.axApplicationMgr.Location = new System.Drawing.Point(644, 332); this.axApplicationMgr.Name = "axApplicationMgr"; this.axApplicationMgr.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axApplicationMgr.OcxState"))); this.axApplicationMgr.Size = new System.Drawing.Size(32, 32); this.axApplicationMgr.TabIndex = 16; this.axApplicationMgr.ExitApplication += new System.EventHandler(this.axApplicationMgr_ExitApplication); this.axApplicationMgr.ReportError += new NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_ReportErrorEventHandler(this.axApplicationMgr_ReportError); this.axApplicationMgr.DisplaySequenceFile += new NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_DisplaySequenceFileEventHandler(this.axApplicationMgr_DisplaySequenceFile); this.axApplicationMgr.DisplayExecution += new NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_DisplayExecutionEventHandler(this.axApplicationMgr_DisplayExecution); // // axFilesComboBox // this.axFilesComboBox.Location = new System.Drawing.Point(112, 8); this.axFilesComboBox.Name = "axFilesComboBox"; this.axFilesComboBox.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axFilesComboBox.OcxState"))); this.axFilesComboBox.Size = new System.Drawing.Size(505, 22); this.axFilesComboBox.TabIndex = 1; // // axSequencesComboBox // this.axSequencesComboBox.Location = new System.Drawing.Point(112, 37); this.axSequencesComboBox.Name = "axSequencesComboBox"; this.axSequencesComboBox.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSequencesComboBox.OcxState"))); this.axSequencesComboBox.Size = new System.Drawing.Size(505, 22); this.axSequencesComboBox.TabIndex = 4; // // axOpenFileButton // this.axOpenFileButton.Location = new System.Drawing.Point(622, 5); this.axOpenFileButton.Name = "axOpenFileButton"; this.axOpenFileButton.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axOpenFileButton.OcxState"))); this.axOpenFileButton.Size = new System.Drawing.Size(167, 26); this.axOpenFileButton.TabIndex = 2; // // axCloseFileButton // this.axCloseFileButton.Location = new System.Drawing.Point(622, 35); this.axCloseFileButton.Name = "axCloseFileButton"; this.axCloseFileButton.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axCloseFileButton.OcxState"))); this.axCloseFileButton.Size = new System.Drawing.Size(167, 26); this.axCloseFileButton.TabIndex = 5; // // GCTimer // this.GCTimer.Interval = 3000; this.GCTimer.Tick += new System.EventHandler(this.GCTimerTick); // // axExecutionViewMgr // this.axExecutionViewMgr.Enabled = true; this.axExecutionViewMgr.Location = new System.Drawing.Point(720, 331); this.axExecutionViewMgr.Name = "axExecutionViewMgr"; this.axExecutionViewMgr.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axExecutionViewMgr.OcxState"))); this.axExecutionViewMgr.Size = new System.Drawing.Size(32, 32); this.axExecutionViewMgr.TabIndex = 18; // // axSequenceFileViewMgr // this.axSequenceFileViewMgr.Enabled = true; this.axSequenceFileViewMgr.Location = new System.Drawing.Point(682, 331); this.axSequenceFileViewMgr.Name = "axSequenceFileViewMgr"; this.axSequenceFileViewMgr.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSequenceFileViewMgr.OcxState"))); this.axSequenceFileViewMgr.Size = new System.Drawing.Size(32, 32); this.axSequenceFileViewMgr.TabIndex = 17; // // axEntryPoint1Button // this.axEntryPoint1Button.Location = new System.Drawing.Point(112, 63); this.axEntryPoint1Button.Name = "axEntryPoint1Button"; this.axEntryPoint1Button.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axEntryPoint1Button.OcxState"))); this.axEntryPoint1Button.Size = new System.Drawing.Size(167, 26); this.axEntryPoint1Button.TabIndex = 6; // // axEntryPoint2Button // this.axEntryPoint2Button.Location = new System.Drawing.Point(281, 63); this.axEntryPoint2Button.Name = "axEntryPoint2Button"; this.axEntryPoint2Button.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axEntryPoint2Button.OcxState"))); this.axEntryPoint2Button.Size = new System.Drawing.Size(167, 26); this.axEntryPoint2Button.TabIndex = 7; // // axRunSelectedButton // this.axRunSelectedButton.Location = new System.Drawing.Point(450, 63); this.axRunSelectedButton.Name = "axRunSelectedButton"; this.axRunSelectedButton.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axRunSelectedButton.OcxState"))); this.axRunSelectedButton.Size = new System.Drawing.Size(167, 26); this.axRunSelectedButton.TabIndex = 8; // // axExecutionsComboBox // this.axExecutionsComboBox.Location = new System.Drawing.Point(112, 95); this.axExecutionsComboBox.Name = "axExecutionsComboBox"; this.axExecutionsComboBox.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axExecutionsComboBox.OcxState"))); this.axExecutionsComboBox.Size = new System.Drawing.Size(505, 22); this.axExecutionsComboBox.TabIndex = 10; // // axCloseExecutionButton // this.axCloseExecutionButton.Location = new System.Drawing.Point(622, 92); this.axCloseExecutionButton.Name = "axCloseExecutionButton"; this.axCloseExecutionButton.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axCloseExecutionButton.OcxState"))); this.axCloseExecutionButton.Size = new System.Drawing.Size(167, 26); this.axCloseExecutionButton.TabIndex = 11; // // sequenceFileLabel // this.sequenceFileLabel.Location = new System.Drawing.Point(5, 12); this.sequenceFileLabel.Name = "sequenceFileLabel"; this.sequenceFileLabel.Size = new System.Drawing.Size(96, 16); this.sequenceFileLabel.TabIndex = 0; this.sequenceFileLabel.Text = "Sequence Files:"; // // sequenceLabel // this.sequenceLabel.Location = new System.Drawing.Point(5, 40); this.sequenceLabel.Name = "sequenceLabel"; this.sequenceLabel.Size = new System.Drawing.Size(96, 16); this.sequenceLabel.TabIndex = 3; this.sequenceLabel.Text = "Sequences:"; // // executionLabel // this.executionLabel.Location = new System.Drawing.Point(5, 100); this.executionLabel.Name = "executionLabel"; this.executionLabel.Size = new System.Drawing.Size(96, 16); this.executionLabel.TabIndex = 9; this.executionLabel.Text = "Executions:"; // // axSequenceView // this.axSequenceView.Enabled = true; this.axSequenceView.Location = new System.Drawing.Point(5, 125); this.axSequenceView.Name = "axSequenceView"; this.axSequenceView.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSequenceView.OcxState"))); this.axSequenceView.Size = new System.Drawing.Size(784, 200); this.axSequenceView.TabIndex = 12; // // axReportView // this.axReportView.Enabled = true; this.axReportView.Location = new System.Drawing.Point(5, 361); this.axReportView.Name = "axReportView"; this.axReportView.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axReportView.OcxState"))); this.axReportView.Size = new System.Drawing.Size(784, 205); this.axReportView.TabIndex = 19; // // axBreakResumeButton // this.axBreakResumeButton.Location = new System.Drawing.Point(5, 330); this.axBreakResumeButton.Name = "axBreakResumeButton"; this.axBreakResumeButton.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axBreakResumeButton.OcxState"))); this.axBreakResumeButton.Size = new System.Drawing.Size(167, 26); this.axBreakResumeButton.TabIndex = 13; // // axTerminateRestartButton // this.axTerminateRestartButton.Location = new System.Drawing.Point(176, 330); this.axTerminateRestartButton.Name = "axTerminateRestartButton"; this.axTerminateRestartButton.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axTerminateRestartButton.OcxState"))); this.axTerminateRestartButton.Size = new System.Drawing.Size(167, 26); this.axTerminateRestartButton.TabIndex = 14; // // axLoginLogoutButton // this.axLoginLogoutButton.Location = new System.Drawing.Point(451, 571); this.axLoginLogoutButton.Name = "axLoginLogoutButton"; this.axLoginLogoutButton.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axLoginLogoutButton.OcxState"))); this.axLoginLogoutButton.Size = new System.Drawing.Size(167, 26); this.axLoginLogoutButton.TabIndex = 20; // // axExitButton // this.axExitButton.Location = new System.Drawing.Point(622, 571); this.axExitButton.Name = "axExitButton"; this.axExitButton.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axExitButton.OcxState"))); this.axExitButton.Size = new System.Drawing.Size(167, 26); this.axExitButton.TabIndex = 21; // // axTerminateAllButton // this.axTerminateAllButton.Location = new System.Drawing.Point(347, 330); this.axTerminateAllButton.Name = "axTerminateAllButton"; this.axTerminateAllButton.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axTerminateAllButton.OcxState"))); this.axTerminateAllButton.Size = new System.Drawing.Size(167, 26); this.axTerminateAllButton.TabIndex = 15; // // MainForm // this.ClientSize = new System.Drawing.Size(794, 604); this.Controls.Add(this.axTerminateAllButton); this.Controls.Add(this.axExitButton); this.Controls.Add(this.axSequenceView); this.Controls.Add(this.axLoginLogoutButton); this.Controls.Add(this.axTerminateRestartButton); this.Controls.Add(this.axBreakResumeButton); this.Controls.Add(this.axReportView); this.Controls.Add(this.executionLabel); this.Controls.Add(this.sequenceLabel); this.Controls.Add(this.sequenceFileLabel); this.Controls.Add(this.axExecutionsComboBox); this.Controls.Add(this.axRunSelectedButton); this.Controls.Add(this.axEntryPoint2Button); this.Controls.Add(this.axEntryPoint1Button); this.Controls.Add(this.axSequenceFileViewMgr); this.Controls.Add(this.axExecutionViewMgr); this.Controls.Add(this.axCloseFileButton); this.Controls.Add(this.axOpenFileButton); this.Controls.Add(this.axCloseExecutionButton); this.Controls.Add(this.axSequencesComboBox); this.Controls.Add(this.axFilesComboBox); this.Controls.Add(this.axApplicationMgr); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.Name = "MainForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Simple Test Executive Operator Interface Example"; this.Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_Closing); this.Load += new System.EventHandler(this.MainForm_Load); ((System.ComponentModel.ISupportInitialize)(this.axApplicationMgr)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axFilesComboBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axSequencesComboBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axOpenFileButton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axCloseFileButton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axExecutionViewMgr)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axSequenceFileViewMgr)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axEntryPoint1Button)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axEntryPoint2Button)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axRunSelectedButton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axExecutionsComboBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axCloseExecutionButton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axSequenceView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axReportView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axBreakResumeButton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axTerminateRestartButton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axLoginLogoutButton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axExitButton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axTerminateAllButton)).EndInit(); this.ResumeLayout(false); }