//        public string dataGridView_ToolTipText =
//@"Lists the File Properties written to the TDMS log file.
//
//For each property, the following information is stored:
//Name (string)
//Data type (tdsDataType)
//Value (strings are encoded in UTF-8 Unicode).
//
//Strings in TDMS files can be null-terminated, but since the length
//information is stored, the null terminator will be ignored when
//you read from the file.";

        public AdvancedLoggingProperties(SequenceContext _seqContext, ConfigureLoggingFile CallingForm)
        {
            InitializeComponent();
            CallingFormGlobal = CallingForm;
            //Set up Teststand objects
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();
            EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes();

            eval.PropertyValueTypeFlags = 0x4; //set string as the valid evaluation type
            EvaluationTypes evalNumeric = seqContext.Engine.NewEvaluationTypes();

            stepPropertyObject        = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            FileDescription_text.Text = CallingForm.fileDescription;
            filePropertyNames         = CallingFormGlobal.filePropertyNames;
            filePropertyValues        = CallingFormGlobal.filePropertyValues;

            InitializeFilePropertiesDataGridView();
            VSDialogs vsdiag = new VSDialogs();
            //this.OK.Click +=new EventHandler(OK_Click,new EventArgs(_fileAuthor));
        }
Esempio n. 2
0
        public ConfigureRTSequence(SequenceContext _seqContext, ConcurrentQueue <SequenceCallInfo[]> _cq)
        {
            InitializeComponent();

            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals;
            propObjectFile     = seqFile.AsPropertyObjectFile();
            VSDialogs vsdiag = new VSDialogs();

            cq = _cq;
            selectedSequence   = 0;
            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();


            //Get old values if they exist
            try
            {
                autostart = stepPropertyObject.GetValBoolean("Veristand.StimProfAutoStart", 0);
                this.auto_start.Checked = autostart;
                timeout = (uint)stepPropertyObject.GetValNumber("Veristand.StimProfTimeout", 0);
                this.rtseq_timeout.Value      = timeout;
                this.sessionName_Control.Text = stepPropertyObject.GetValString("Veristand.RTSessionName", 0);
                sequenceNames   = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.SequenceNames", 0), o => o.ToString());
                parameterValues = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.ParamValues", 0), o => o.ToString());
                parameterTypes  = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.ParamTypes", 0), o => o.ToString());
                parameterNames  = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.ParamNames", 0), o => o.ToString());
                numSequences    = (int)stepPropertyObject.GetValNumber("Veristand.RTNumSequences", 0);
                try
                {
                    InitializeDataGridView(sequenceNames[0], parameterValues, parameterTypes, numSequences, 0); //Initialize the data grid with the previously selected data
                    this.FilePath.Text = sequenceNames[0];
                }
                catch (System.ArgumentException ex)
                {
                    //Intentially do nothing
                }
                catch (IndexOutOfRangeException ex)
                {
                    //no sequences, don't need to initialize the data grid
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                //Variables are not already created in TestStand. They will be created later
                vsdiag.ShowWarningDialog(ex.Message + "------" + ex.StackTrace);

                autostart               = false;
                StimProfilePathStr      = "";
                this.auto_start.Checked = autostart;
                this.FilePath.Text      = StimProfilePathStr;
                timeout = 1000;
                this.rtseq_timeout.Value      = timeout;
                this.sessionName_Control.Text = "Session 1";
            }
        }
        public GetChannelsDialog(SequenceContext _seqContext, ChannelType _channelType)
        {
            InitializeComponent();
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();
            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            //Set up dialog objects
            sysDefPath = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1); //Get the System Definition path for the Client Sequence File. Create it if it does not exist.
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
            channelNamesList.AddRange(stepPropertyObject.GetValVariant("VeriStand.ChannelNames", 0));                        //Get ChannelNames array of strings.
            channelType = _channelType;

            VSDialogs vsdiag = new VSDialogs();

            this.loggingChannelSelection.ShowCheckBox = true;

            //If the file at path FileGlobals.Veristand.SystemDefinitionPath exists and the extension is ".nivssdf" use that System Definition file to initialize the TreeAliasBrowserWF.
            if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sysDefPath)) == ".nivssdf")
            {
                //File exists with correct extension so try and populate the tree
                InitializeListBox(sysDefPath);
            }
            //If FileGlobals.Veristand.SystemDefinitionPath is empty or the file does not exist at path FileGlobals.Veristand.SystemDefinitionPath.
            else //(sysDefPath == "" || !System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)))
            {
                //Do nothing
            }
        }
Esempio n. 4
0
        public ConfigureSequenceName(SequenceContext _seqContext)
        {
            InitializeComponent();

            seqContext         = _seqContext;
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            seqContextPO       = selectedTSSequence.Locals;
            int thisStepIndex = selectedTSStep.StepIndex;

            propObjectFile = seqFile.AsPropertyObjectFile();
            try
            {
                this.sequenceName_Control.Text = seqContextPO.GetValString("Veristand." + stepID + "RTSequenceName", 0);
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                //If variables don't exist set default values
                this.sequenceName_Control.Text = "";
            }
            int  count = thisStepIndex;
            bool found = false;

            while (count >= 0 && found == false)
            {
                Step currentStep = selectedTSSequence.GetStep(count, StepGroups.StepGroup_Main);
                if (currentStep.Name == "Open and Deploy RT Sequence") //This will need to change if the name of the Open RT Sequence Name Step Changes
                {
                    //this is the open RTSequence step that is the closes previous to this step name configuration
                    string    openRTSequenceStepID = currentStep.UniqueStepId;
                    VSDialogs vsdiags = new VSDialogs();
                    try                                                                                            //When this does and does not exist is different from the RTSequenceName so it needs its own Try/Catch block
                    {
                        seqCallInfoArray = vsdiags.ReinitializeSequenceCallInfo(seqContext, openRTSequenceStepID); //Get the sequence info created by the Open RT Sequence Step
                        allSequenceNames = ParseNamesFromSequenceCallInfo(seqCallInfoArray);                       //Populate the parsed list of sequence names
                        if (allSequenceNames.Length > 0)
                        {
                            if (allSequenceNames[0] != null)
                            {
                                //Set the sequence name control to the first name we parsed
                                this.sequenceName_Control.Text = allSequenceNames[0];
                            }
                            else
                            {
                                this.sequenceName_Control.Text = "";
                            }
                        }
                    }
                    catch (System.Runtime.InteropServices.COMException)
                    {
                        seqCallInfoArray = null;
                    }
                }
                count--;
            }
        }
        public NativeChannelSelectionDialog(SequenceContext _seqContext, ChannelType _channelType)
        {
            InitializeComponent();
            channelType = _channelType;

            //Set up Teststand objects
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();
            EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes();

            eval.PropertyValueTypeFlags = 0x4; //set string as the valid evaluation type
            EvaluationTypes evalNumeric = seqContext.Engine.NewEvaluationTypes();

            evalNumeric.PropertyValueTypeFlags = 0x2; //Set valid evaluation types to number
            value_exp.SetValidEvaluationTypes(evalNumeric);
            value_exp.Context  = seqContextPO;
            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            VSDialogs vsdiag = new VSDialogs();

            try
            {
                value_exp.Text      = stepPropertyObject.GetValString("Veristand.ValueToSet", 0);
                selectedChannelName = stepPropertyObject.GetValString("Veristand.ChannelName", 0);
                sysDefPath          = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1);//Try to get the specific system definition path associated with this step
                seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
                if (sysDefPath == null)
                {
                    sysDefPath = "";
                }
                if (channelType == ChannelType.paramChannel)
                {
                    ModelListFullPath = stepPropertyObject.GetValString("Veristand.FullChannelPath", 0);
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                selectedChannelName = "";
            }
            catch (System.NullReferenceException ex)
            {
                //Do Nothing
            }

            if (sysDefPath != null)
            {
                if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sysDefPath)) == ".nivssdf")
                {
                    //File exists with correct extension so try and populate the tree
                    InitializeListBox(sysDefPath);
                }
            }
        }
        public ChannelSelectionDialog(SequenceContext _seqContext, bool _ModelList)
        {
            ModelList = _ModelList;
            InitializeComponent();


            //Set up Teststand objects
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();


            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            try
            {
                channelValue         = stepPropertyObject.GetValNumber("Veristand.ValueToSet", 0);
                selectedChannelName  = stepPropertyObject.GetValString("Veristand.ChannelName", 0);
                SystemDefinitionPath = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1);//Try to get the specific system definition path associated with this step
                seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
                this.SystemDefinitionPathControl.Text = SystemDefinitionPath;
                this.set_value_control.Value          = (decimal)channelValue;
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                selectedChannelName  = "";
                SystemDefinitionPath = ""; //If there is no system definition path default to the empty string
                this.SystemDefinitionPathControl.Text = SystemDefinitionPath;
            }
            if (System.IO.File.Exists(SystemDefinitionPath) && System.IO.Path.GetExtension(SystemDefinitionPath) == ".nivssdf")
            {
                //File exists with correct extension so try and populate the grid
                TreeNodeCollection tempTreeNodeCollection = InitializeListBox(SystemDefinitionPath);
                treeNodes = new TreeNode[tempTreeNodeCollection.Count];
                tempTreeNodeCollection.CopyTo(treeNodes, 0);
            }
            if (selectedChannelName != "")
            {
                TreeNode[] foundNodes = this.ChannelSelection.Nodes.Find(selectedChannelName, true);

                if (foundNodes.Length > 0)
                {
                    this.ChannelSelection.SelectedNode           = foundNodes[0];//Only one node should match exactly
                    this.ChannelSelection.HideSelection          = false;
                    this.ChannelSelection.SelectedNode.BackColor = Color.Violet;
                    this.ChannelSelection.Focus();//This does not seem to be working
                }
            }
        }
        public ConfigureSystemDefinition(SequenceContext _seqContext, bool _deploying)
        {
            InitializeComponent();

            //Set up Teststand objects
            deploying          = _deploying;
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();


            EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes();

            eval.PropertyValueTypeFlags = 0x4;
            EvaluationTypes evalBool = seqContext.Engine.NewEvaluationTypes();

            evalBool.PropertyValueTypeFlags = 0x1;//Booleans are valid
            deploysysdef_exp.SetValidEvaluationTypes(evalBool);
            systemDefinitionPath_exp.SetValidEvaluationTypes(eval);
            deploysysdef_exp.Context         = seqContextPO;
            systemDefinitionPath_exp.Context = seqContextPO;
            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            if (!deploying)
            {
                this.systemDefinitionPath_exp.Visible  = false;
                this.SystemDefinitionPathLabel.Visible = false;
                this.Browse.Visible = false;
            }
            //Get old variable values if they exist
            try
            {
                deploysysdef_exp.Text = stepPropertyObject.GetValString("Veristand.DeploySystemDefinition", 0);
                if (deploying)
                {
                    SystemDefinitionPath = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1);
                    seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
                    this.systemDefinitionPath_exp.Text = SystemDefinitionPath;
                }
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                //Variables are not already created. They will be created later
                deploysysdef_exp.Text = "True";
                SystemDefinitionPath  = "";
                this.systemDefinitionPath_exp.Text = SystemDefinitionPath;
            }
        }
Esempio n. 8
0
        private void OK_Click(object sender, EventArgs e)
        {
            try
            {
                BaseNodeType[] selections =
                    this._aliasBrowser.GetCheckBoxSelections(false)
                    .Concat(this._treeView.GetCheckBoxSelections(false))
                    .ToArray();
                channelNamesList.Clear();
                if (selections.Length > 0)
                {
                    channelNamesList.AddRange(from selection in selections where selection is NationalInstruments.VeriStand.SystemStorage.ChannelType || selection is AliasType select selection.NodePath);
                    stepPropertyObject.SetValVariant("VeriStand.ChannelNames", 0, channelNamesList.ToArray());
                    baseNodeArray = selections;
                    stepPropertyObject.SetValInterface("VeriStand.BaseNodeArray", 0, baseNodeArray);
                }

                //sysDefPath;
            }
            catch (System.NullReferenceException ex)
            {
                //do nothing
            }
            catch (System.IndexOutOfRangeException ex)
            {
                //do nothing
            }
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetValString("Veristand.SystemDefinitionPath", 1, sysDefPath);
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
            propObjectFile.IncChangeCount();  //Sets the flag that means the sequence has changes to save  (dirty dot*)
            System.Runtime.InteropServices.Marshal.ReleaseComObject(seqContext);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(seqContextPO);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(selectedTSSequence);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(seqFile);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(permSeqContext);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(selectedTSStep);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(propObjectFile);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(stepPropertyObject);
            seqContext         = null;
            seqContextPO       = null;
            selectedTSSequence = null;
            seqFile            = null;
            permSeqContext     = null;
            selectedTSStep     = null;
            propObjectFile     = null;
            stepPropertyObject = null;
            this.Close(); //Close the form
        }
        public ConfigureLoggingFile(SequenceContext _seqContext, ChannelType _channelType)
        {
            InitializeComponent();
            //Set up Teststand objects
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();
            EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes();

            eval.PropertyValueTypeFlags = 0x4; //set string as the valid evaluation type
            LogFilePath_exp.SetValidEvaluationTypes(eval);
            LogFilePath_exp.Context = seqContextPO;
            EvaluationTypes evalNumeric = seqContext.Engine.NewEvaluationTypes();

            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();

            //Set up dialog objects
            sysDefPath = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1); //Get the System Definition path for the Client Sequence File. Create it if it does not exist.
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
            channelList                     = stepPropertyObject.GetValVariant("Veristand.ChannelPaths", 0);                 //Get ChannelPaths array of strings.
            LogFilePath_exp.Text            = stepPropertyObject.GetValString("Veristand.LogFilePath", 0);                   //Try to get the Log File Path associated with this step
            SegmentFileSize_boolean.Checked = stepPropertyObject.GetValBoolean("Veristand.FileSegmenting", 0);               //Get the boolean for Segmenting File Size option
            FileSegmentSize_num.Value       = (int)stepPropertyObject.GetValNumber("Veristand.FileSegmentingSize", 0);       //Get the File Segment Size value
            fileDescription                 = stepPropertyObject.GetValString("Veristand.FileDescription", 0);               //Get the File Description advanced property
            filePropertyNames.AddRange(stepPropertyObject.GetValVariant("Veristand.FilePropertyNames", 0));
            filePropertyValues.AddRange(stepPropertyObject.GetValVariant("Veristand.FilePropertyValues", 0));
            channelType = _channelType;
            loggingChannelSelection.ShowCheckBox = true;

            //If the file at path FileGlobals.Veristand.SystemDefinitionPath exists and the extension is ".nivssdf" use that System Definition file to initialize the TreeAliasBrowserWF.
            if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sysDefPath)) == ".nivssdf")
            {
                //File exists with correct extension so try and populate the tree
                InitializeListBox(sysDefPath);
            }
            //If FileGlobals.Veristand.SystemDefinitionPath is empty or the file does not exist at path FileGlobals.Veristand.SystemDefinitionPath.
            else     //(sysDefPath == "" || !System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)))
            {
                //Do nothing
            }
            VSDialogs vsdiag = new VSDialogs();
        }
 private void OK_Click(object sender, EventArgs e)
 {
     try
     {
         BaseNodeType[] selections =
             this.loggingChannelSelection.GetCheckBoxSelections(false)
             .ToArray();
         channelList = (from selection in selections where selection is NationalInstruments.VeriStand.SystemStorage.ChannelType || selection is AliasType select selection.NodePath).ToArray();
         stepPropertyObject.SetValVariant("Veristand.ChannelPaths", 0, channelList);
         stepPropertyObject.SetValString("Veristand.LogFilePath", 0, LogFilePath_exp.Text);
         stepPropertyObject.SetValBoolean("Veristand.FileSegmenting", 0, SegmentFileSize_boolean.Checked);
         stepPropertyObject.SetValNumber("Veristand.FileSegmentingSize", 0, (int)FileSegmentSize_num.Value);
         stepPropertyObject.SetValString("Veristand.FileDescription", 0, fileDescription);
         seqContext.SequenceFile.FileGlobalsDefaultValues.SetValString("Veristand.SystemDefinitionPath", 1, sysDefPath);
         seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
         stepPropertyObject.SetValVariant("Veristand.FilePropertyNames", 0, filePropertyNames.ToArray());
         stepPropertyObject.SetValVariant("Veristand.FilePropertyValues", 0, filePropertyValues.ToArray());
     }
     catch (System.NullReferenceException ex)
     {
         //do nothing
     }
     catch (System.IndexOutOfRangeException ex)
     {
         //do nothing
     }
     propObjectFile.IncChangeCount();  //Sets the flag that means the sequence has changes to save (dirty dot*)
     System.Runtime.InteropServices.Marshal.ReleaseComObject(seqContext);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(seqContextPO);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(selectedTSSequence);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(seqFile);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(permSeqContext);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(selectedTSStep);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(propObjectFile);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(stepPropertyObject);
     seqContext         = null;
     seqContextPO       = null;
     selectedTSSequence = null;
     seqFile            = null;
     permSeqContext     = null;
     selectedTSStep     = null;
     propObjectFile     = null;
     stepPropertyObject = null;
     this.Close();
 }
        public SetMultipleChannelsDialogDGV(SequenceContext _seqContext, ChannelType _channelType)
        {
            InitializeComponent();
            this.DoubleBuffered = true;
            //Set up Teststand objects
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();
            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();

            //Set up dialog objects
            sysDefPath = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1); //Get the System Definition path for the Client Sequence File. Create it if it does not exist.
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
            channelNamesList.AddRange(stepPropertyObject.GetValVariant("VeriStand.ChannelNames", 0));                        //Get ChannelNames array of strings.
            channelValuesArray = stepPropertyObject.GetValVariant("VeriStand.ValuesToSet", 0);                               //Get ValuesToSet array of numbers
            channelType        = _channelType;

            if (baseNodeArray != null)
            {
                baseNodeArray = (BaseNodeType[])stepPropertyObject.GetValInterface("Veristand.BaseNodeArray", 0);//Get the BaseNodeArray from TestStand and cast to a BaseNodeType[]
            }
            else
            {
                baseNodeArray = new BaseNodeType[0];
            }

            VSDialogs vsdiag = new VSDialogs();

            //If the file at path FileGlobals.Veristand.SystemDefinitionPath exists and the extension is ".nivssdf" use that System Definition file to initialize the list of channels in the dataGridView1
            if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sysDefPath)) == ".nivssdf")
            {
                //File exists with correct extension so try and populate the tree
                InitializeDataGridView(sysDefPath, channelNamesList, channelValuesArray, true);
            }
            //If FileGlobals.Veristand.SystemDefinitionPath is empty or the file does not exist at path FileGlobals.Veristand.SystemDefinitionPath.
            else //(sysDefPath == "" || !System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)))
            {
                //Do nothing
            }
        }
Esempio n. 12
0
        public ConfigureAlarm(SequenceContext _seqContext)
        {
            InitializeComponent();


            //Set up Teststand objects
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();
            EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes();

            eval.PropertyValueTypeFlags = 0x4; //set string as the valid evaluation type
            systemDefinitionPath_exp.SetValidEvaluationTypes(eval);
            systemDefinitionPath_exp.Context = seqContextPO;
            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            VSDialogs vsdiag = new VSDialogs();

            try
            {
                alarmstate_control.SelectedItem = StringUtilities.removeDoubleQuotesAroundString(stepPropertyObject.GetValString("Veristand.AlarmState", 0));
                alarmName                     = stepPropertyObject.GetValString("Veristand.AlarmName", 0);
                AlarmListFullPath             = stepPropertyObject.GetValString("Veristand.FullAlarmPath", 0);
                systemDefinitionPath_exp.Text = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1);//Try to get the specific system definition path associated with this step
                seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                systemDefinitionPath_exp.Text = ""; //If there is no system definition path default to the empty string
            }
            if (System.IO.File.Exists(StringUtilities.unparseFilePathString(systemDefinitionPath_exp.Text)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(systemDefinitionPath_exp.Text)) == ".nivssdf")
            {
                //File exists with correct extension so try and populate the tree
                InitializeListBox(systemDefinitionPath_exp.Text);
            }
        }
        public SetMultipleChannelsDialog(SequenceContext _seqContext, ChannelType _channelType)
        {
            InitializeComponent();
            //this.DoubleBuffered = true;
            //Set up Teststand objects
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();
            EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes();

            eval.PropertyValueTypeFlags = 0x4; //set string as the valid evaluation type
            EvaluationTypes evalNumeric = seqContext.Engine.NewEvaluationTypes();

            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();

            //Set up dialog objects
            sysDefPath = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1); //Get the System Definition path for the Client Sequence File. Create it if it does not exist.
            channelNamesList.AddRange(stepPropertyObject.GetValVariant("VeriStand.ChannelNames", 0));                        //Get ChannelNames array of strings.
            channelValuesArray = stepPropertyObject.GetValVariant("VeriStand.ValuesToSet", 0);                               //Get ValuesToSet array of numbers
            channelType        = _channelType;
            VSDialogs vsdiag = new VSDialogs();

            //If the file at path FileGlobals.Veristand.SystemDefinitionPath exists and the extension is ".nivssdf" use that System Definition file to initialize the list of channels in the dataGridView1
            if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sysDefPath)) == ".nivssdf")
            {
                //File exists with correct extension so try and populate the tree
                InitializeTableView(sysDefPath, channelNamesList, channelValuesArray);
            }
            //If FileGlobals.Veristand.SystemDefinitionPath is empty or the file does not exist at path FileGlobals.Veristand.SystemDefinitionPath.
            else //(sysDefPath == "" || !System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)))
            {
                //Do nothing
            }
        }
        public StimulusProfileDialog(SequenceContext _seqContext)
        {
            InitializeComponent();

            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();


            EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes();

            eval.PropertyValueTypeFlags = 0x4;
            stimulusProfilePath_exp.SetValidEvaluationTypes(eval);
            stimulusProfilePath_exp.Context = seqContextPO;
            gatewayIP_exp.SetValidEvaluationTypes(eval);
            gatewayIP_exp.Context = seqContextPO;
            uut_exp.SetValidEvaluationTypes(eval);
            uut_exp.Context    = seqContextPO;
            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();

            try
            {
                this.stimulusProfilePath_exp.Text = StringUtilities.addDoubleQuotesAroundString(stepPropertyObject.GetValString("Veristand.StimulusProfilePath", 0));
                this.gatewayIP_exp.Text           = StringUtilities.addDoubleQuotesAroundString(seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.GatewayIP", 0));
                this.uut_exp.Text = StringUtilities.addDoubleQuotesAroundString(stepPropertyObject.GetValString("Veristand.UUT", 0));
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                //Variables are not already created. They will be created later
                this.gatewayIP_exp.Text           = StringUtilities.addDoubleQuotesAroundString("localhost");
                this.stimulusProfilePath_exp.Text = StringUtilities.addDoubleQuotesAroundString("");
                this.uut_exp.Text = StringUtilities.addDoubleQuotesAroundString("0");
            }
        }
 private void OK_Click(object sender, EventArgs e)
 {
     if (this.dataGridView1.Rows.Count > 0)
     {
         channelNamesList.Clear();
         Array.Resize(ref channelValuesArray, this.dataGridView1.Rows.Count);
         for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
         {
             if (this.dataGridView1[0, i].Value != null /*&& this.dataGridView1[1, i].Value != null*/)
             {
                 channelNamesList.Add(this.dataGridView1[0, i].Value.ToString());
                 channelValuesArray[i] = Convert.ToDouble(this.dataGridView1[1, i].Value);
             }
         }
     }
     stepPropertyObject.SetValVariant("VeriStand.ChannelNames", 0, channelNamesList.ToArray());
     stepPropertyObject.SetValVariant("VeriStand.ValuesToSet", 0, channelValuesArray);
     stepPropertyObject.SetValInterface("VeriStand.BaseNodeArray", 0, baseNodeArray);
     seqContext.SequenceFile.FileGlobalsDefaultValues.SetValString("VeriStand.SystemDefinitionPath", 1, sysDefPath);
     seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
     propObjectFile.IncChangeCount();  //Sets the flag that means the sequence has changes to save  (dirty dot*)
     System.Runtime.InteropServices.Marshal.ReleaseComObject(seqContext);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(seqContextPO);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(selectedTSSequence);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(seqFile);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(permSeqContext);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(selectedTSStep);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(propObjectFile);
     System.Runtime.InteropServices.Marshal.ReleaseComObject(stepPropertyObject);
     seqContext         = null;
     seqContextPO       = null;
     selectedTSSequence = null;
     seqFile            = null;
     permSeqContext     = null;
     selectedTSStep     = null;
     propObjectFile     = null;
     stepPropertyObject = null;
     this.Close(); //Close the form
 }
        public ConfigureLegacyStimulusProfile(SequenceContext _seqContext)
        {
            InitializeComponent();

            //Set up Teststand objects
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();

            //Get old values if they exist
            try
            {
                autostart = seqContextPO.GetValBoolean("Locals.Veristand.StimProfAutoStart" + stepID, 0);
                this.AutoStart.Checked = autostart;
                StimProfilePathStr     = seqContextPO.GetValString("Locals.Veristand.StimProfPath" + stepID, 0);
                this.FilePath.Text     = StimProfilePathStr;
                timeout            = (uint)seqContextPO.GetValNumber("Locals.Veristand.StimProfTimeout" + stepID, 0);
                this.Timeout.Value = timeout;
                stopOnDisconnect   = seqContextPO.GetValBoolean("Locals.Veristand.StimProfStopOnDisconnect" + stepID, 0);
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                //Variables are not already created in TestStand. They will be created later
                autostart              = false;
                StimProfilePathStr     = "";
                this.AutoStart.Checked = autostart;
                this.FilePath.Text     = StimProfilePathStr;
                timeout                     = 1000;
                this.Timeout.Value          = timeout;
                stopOnDisconnect            = false;
                this.StopDisconnect.Checked = stopOnDisconnect;
            }
        }
Esempio n. 17
0
        public ModelParametersFromFile(SequenceContext _seqContext)
        {
            InitializeComponent();

            //Set up Teststand objects
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();
            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            EvaluationTypes evalString = seqContext.Engine.NewEvaluationTypes();

            evalString.PropertyValueTypeFlags = 0x4; //set string as the valid evaluation type
            target_exp.SetValidEvaluationTypes(evalString);
            target_exp.Context = seqContextPO;
            EvaluationTypes evalStringArray = seqContext.Engine.NewEvaluationTypes();

            evalStringArray.PropertyValueTypeFlags = 0x100; //set string array as the valid evaluation type
            parameterfile_exp.SetValidEvaluationTypes(evalStringArray);
            parameterfile_exp.Context = seqContextPO;
            //Get old values if they exist
            try
            {
                this.parameterfile_exp.Text = stepPropertyObject.GetValString("Veristand.ModelParameterFilepath", 0);
                this.target_exp.Text        = stepPropertyObject.GetValString("Veristand.TargetName", 0);
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                //Variables are not already created. They will be created later
                this.parameterfile_exp.Text = "";
                this.target_exp.Text        = "";
            }
        }
        public ConfigureGateway(SequenceContext _seqContext)
        {
            //Initialize Windows form
            InitializeComponent();

            //Set up Teststand objects
            seqContext            = _seqContext;
            seqContextPO          = seqContext.AsPropertyObject();
            selectedTSSequence    = seqContext.SelectedSequences[0];
            selectedTSStep        = seqContext.SelectedSteps[0];
            stepID                = selectedTSStep.UniqueStepId;
            seqFile               = selectedTSSequence.SequenceFile;
            permSeqContext        = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            SeqContextFileGlobals = selectedTSSequence.SequenceFile.FileGlobalsDefaultValues;
            propObjectFile        = seqFile.AsPropertyObjectFile();
            stepPropertyObject    = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            //Get old values if they exist
            username_exp.Context = seqContextPO;
            EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes();

            eval.PropertyValueTypeFlags = 0x4;//Strings are valid
            EvaluationTypes evalBool = seqContext.Engine.NewEvaluationTypes();

            evalBool.PropertyValueTypeFlags = 0x1;//Booleans are valid
            username_exp.SetValidEvaluationTypes(eval);
            password_exp.SetValidEvaluationTypes(eval);
            gatewayIP_exp.SetValidEvaluationTypes(eval);
            projectpath_exp.SetValidEvaluationTypes(eval);
            visible_exp.SetValidEvaluationTypes(evalBool);
            password_exp.Context    = seqContextPO;
            gatewayIP_exp.Context   = seqContextPO;
            projectpath_exp.Context = seqContextPO;
            visible_exp.Context     = seqContextPO;
            try
            {
                EventHandler gatewaychangehandler = new EventHandler(this.gatewayIP_exp_Change);
                this.gatewayIP_exp.Change -= gatewaychangehandler;
                gatewayIP = StringUtilities.addDoubleQuotesAroundString(seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.GatewayIP", 0));
                this.gatewayIP_exp.Text    = gatewayIP;
                this.gatewayIP_exp.Change += gatewaychangehandler;

                EventHandler projchangehandler = new EventHandler(this.projectpath_exp_Change);
                this.projectpath_exp.Change -= projchangehandler;
                projectPathStr               = StringUtilities.addDoubleQuotesAroundString(seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.ProjectPath", 0));
                this.projectpath_exp.Text    = projectPathStr;
                this.projectpath_exp.Change += projchangehandler;

                username = seqContextPO.GetValString("Step.Veristand.username", 0);
                this.username_exp.Text = username;
                password = seqContextPO.GetValString("Step.Veristand.password", 0);
                this.password_exp.Text = password;
                visible_exp.Text       = seqContextPO.GetValString("Step.Veristand.Visible", 0);
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                //Variables are not already created. They will be created later
                EventHandler gatewaychangehandler = new EventHandler(this.gatewayIP_exp_Change);
                this.gatewayIP_exp.Change += gatewaychangehandler;
                gatewayIP = "localhost";
                this.gatewayIP_exp.Text    = gatewayIP;
                this.gatewayIP_exp.Change += gatewaychangehandler;

                EventHandler projchangehandler = new EventHandler(this.projectpath_exp_Change);
                this.projectpath_exp.Change -= projchangehandler;
                projectPathStr               = "";
                this.projectpath_exp.Text    = projectPathStr;
                this.projectpath_exp.Change += projchangehandler;

                this.password_exp.Text = "";
                this.username_exp.Text = "";
            }
        }
Esempio n. 19
0
        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);
                }
            }
        }
        public ConfigureLoggingFile(SequenceContext _seqContext, ChannelType _channelType)
        {
            InitializeComponent();
            //Set up Teststand objects
            seqContext         = _seqContext;
            seqContextPO       = seqContext.AsPropertyObject();
            selectedTSSequence = seqContext.SelectedSequences[0];
            selectedTSStep     = seqContext.SelectedSteps[0];
            stepID             = selectedTSStep.UniqueStepId;
            seqFile            = selectedTSSequence.SequenceFile;
            permSeqContext     = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted
            propObjectFile     = seqFile.AsPropertyObjectFile();
            EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes();

            eval.PropertyValueTypeFlags = 0x4; //set string as the valid evaluation type
            LogFilePath_exp.SetValidEvaluationTypes(eval);
            LogFilePath_exp.Context = seqContextPO;
            EvaluationTypes evalNumeric = seqContext.Engine.NewEvaluationTypes();

            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();

            //Set up dialog objects
            sysDefPath = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1); //Get the System Definition path for the Client Sequence File. Create it if it does not exist.
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
            channelList                     = stepPropertyObject.GetValVariant("Veristand.ChannelPaths", 0);                 //Get ChannelPaths array of strings.
            LogFilePath_exp.Text            = stepPropertyObject.GetValString("Veristand.LogFilePath", 0);                   //Try to get the Log File Path associated with this step
            SegmentFileSize_boolean.Checked = stepPropertyObject.GetValBoolean("Veristand.FileSegmenting", 0);               //Get the boolean for Segmenting File Size option
            FileSegmentSize_num.Value       = (int)stepPropertyObject.GetValNumber("Veristand.FileSegmentingSize", 0);       //Get the File Segment Size value
            fileDescription                 = stepPropertyObject.GetValString("Veristand.FileDescription", 0);               //Get the File Description advanced property
            filePropertyNames.AddRange(stepPropertyObject.GetValVariant("Veristand.FilePropertyNames", 0));
            filePropertyValues.AddRange(stepPropertyObject.GetValVariant("Veristand.FilePropertyValues", 0));
            channelType = _channelType;
            if (stepPropertyObject.GetValInterface("Veristand.BaseNodeArray", 0) != null)
            {
                baseNodeArray = (BaseNodeType[])stepPropertyObject.GetValInterface("Veristand.BaseNodeArray", 0);//Get the BaseNodeArray from TestStand and cast to a BaseNodeType[]
            }
            else
            {
                baseNodeArray = new BaseNodeType[0];
            }

            // These changes are in the 2014 VeriStand trunk so as soon as we start using that assembly we should revert these changes.
            // This is a hack for now to get check boxes on the Windows Form TreeAliasBrowserWF.

            Type      TreeAliasBrowser      = typeof(StorageChannelAndAliasBrowser);
            FieldInfo m_ChanAliasWPFElement = typeof(NationalInstruments.VeriStand.SystemStorageUI.WinFormsWrapper.TreeAliasBrowserWF).GetField(
                "m_ChanAliasWPFElement",
                BindingFlags.NonPublic |
                BindingFlags.Instance);
            FieldInfo aliasBrowserInfo = TreeAliasBrowser.GetField(
                "AliasTab",
                BindingFlags.NonPublic |
                BindingFlags.Instance);
            FieldInfo treeviewInfo = TreeAliasBrowser.GetField(
                "TreeView",
                BindingFlags.NonPublic |
                BindingFlags.Instance);
            var topLevelBrowser = (StorageChannelAndAliasBrowser)m_ChanAliasWPFElement.GetValue(loggingChannelSelection);

            this._aliasBrowser = (SystemDefinitionBrowser)aliasBrowserInfo.GetValue(topLevelBrowser);
            this._treeView     = (SystemDefinitionBrowser)treeviewInfo.GetValue(topLevelBrowser);
            this._aliasBrowser.ShowCheckBox = true;
            this._treeView.ShowCheckBox     = true;

            //If the file at path FileGlobals.Veristand.SystemDefinitionPath exists and the extension is ".nivssdf" use that System Definition file to initialize the TreeAliasBrowserWF.
            if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sysDefPath)) == ".nivssdf")
            {
                //File exists with correct extension so try and populate the tree
                InitializeListBox(sysDefPath);
            }
            //If FileGlobals.Veristand.SystemDefinitionPath is empty or the file does not exist at path FileGlobals.Veristand.SystemDefinitionPath.
            else     //(sysDefPath == "" || !System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)))
            {
                //Do nothing
            }
            VSDialogs vsdiag = new VSDialogs();
        }
 public bool DisplayAttributesDialog(string dlgTitle = "", PropertyObjectFile file = null, int dlgOptions = 0)
 {
     return(_propObj.DisplayAttributesDialog(dlgTitle, file, dlgOptions));
 }
        public ConfigureRTSequenceNumericLimit(SequenceContext _seqContext)
        {
            InitializeComponent();
            returnParamDataType = "";
            seqContext          = _seqContext;
            seqContextPO        = seqContext.AsPropertyObject();
            selectedTSSequence  = seqContext.SelectedSequences[0];
            selectedTSStep      = seqContext.SelectedSteps[0];
            stepID         = selectedTSStep.UniqueStepId;
            seqFile        = selectedTSSequence.SequenceFile;
            permSeqContext = selectedTSSequence.Locals;
            propObjectFile = seqFile.AsPropertyObjectFile();
            EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes();

            eval.PropertyValueTypeFlags = 0x4; //set string as the valid evaluation type
            FilePath.SetValidEvaluationTypes(eval);
            FilePath.Context = seqContextPO;
            EvaluationTypes evalNumeric  = seqContext.Engine.NewEvaluationTypes();
            VSDialogs       vsdiag       = new VSDialogs();
            int             timeoutValue = 0;

            stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();


            //Get old values if they exist
            try
            {
                timeoutValue         = (int)stepPropertyObject.GetValNumber("Veristand.Timeout", 0);
                target               = stepPropertyObject.GetValString("Veristand.Target", 0);
                sequenceFileExp      = stepPropertyObject.GetValString("Veristand.SequenceFilePath", 0);
                parameterValuesArray = StringUtilities.expressionArrayToStringArray(stepPropertyObject.GetValVariant("Veristand.ParamValuesArray", 0));
                parameterTypesArray  = StringUtilities.expressionArrayToStringArray(stepPropertyObject.GetValVariant("Veristand.ParamTypesArray", 0));
                parameterNamesArray  = StringUtilities.expressionArrayToStringArray(stepPropertyObject.GetValVariant("Veristand.ParamNamesArray", 0));
                sysDefPath           = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1);
                seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);

                if (sysDefPath != null && sysDefPath != "")
                {
                    try
                    {
                        currentSysDef = new SystemDefinition(StringUtilities.unparseFilePathString(sysDefPath));
                    }

                    catch (System.ArgumentException ex)
                    {
                        //Do Nothing
                    }
                }

                try
                {
                    this.Timeout.Value     = timeoutValue;
                    this.targetString.Text = target;
                    EventHandler handler = new EventHandler(this.FilePath_TextChanged);

                    /* Disable FilePath_TextChanged event. We need to disable the FilePath_TextChanged event
                     * because when the dialog is launching, the System Definition Path variable from TestStand will
                     * be populated to the FilePath control. Once it is populated, the FilePath control's event will fire,
                     * thus it will try to reload the table. We don't want the table to load twice every time the dialog is launched. */

                    this.FilePath.Change -= handler;

                    // Change the File Path

                    this.FilePath.Text = sequenceFileExp;

                    // Re-enable FilePath_TextChanged event

                    this.FilePath.Change += handler;
                    //If the file at path FileGlobals.Veristand.SystemDefinitionPath exists and the extension is ".nivssdf" use that System Definition file to initialize the TreeAliasBrowserWF.
                    if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sequenceFileExp)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sequenceFileExp)) == ".nivsseq")
                    {
                        //File exists with correct extension so try and populate the tree
                        InitializeTableView(_seqContext, sequenceFileExp, parameterValuesArray, parameterTypesArray, false); //Initialize the data grid with the previously selected data
                    }
                    ////If FileGlobals.Veristand.SystemDefinitionPath is empty or the file does not exist at path FileGlobals.Veristand.SystemDefinitionPath.
                    else //(sysDefPath == "" || !System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)))
                    {
                        //Clear the grid
                        InitializeTableView(_seqContext, "", parameterValuesArray, parameterTypesArray, true);
                    }
                }
                catch (System.ArgumentException ex)
                {
                    //Intentially do nothing
                }
                catch (IndexOutOfRangeException ex)
                {
                    //no sequences, don't need to initialize the data grid
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                //Variables are not already created in TestStand. They will be created later
                vsdiag.ShowWarningDialog(ex.Message + "------" + ex.StackTrace);

                sequenceFileExp    = "";
                this.FilePath.Text = sequenceFileExp;
            }
        }