Example #1
0
        private void OK_Click(object sender, EventArgs e)
        {
            try
            {
                string alarmPath = channel_browser.GetCurrentSelections(false)[0].NodePath;
                stepPropertyObject.SetValString("Veristand.FullAlarmPath", 0, StringUtilities.addDoubleQuotesAroundString(channel_browser.GetCurrentSelections(false)[0].NodePath));
                Match  match     = Regex.Match(alarmPath, @"Alarms/([A-Za-z0-9\/-_]+)", RegexOptions.IgnoreCase);
                string alarmName = match.Groups[1].Value;
                stepPropertyObject.SetValString("Veristand.AlarmName", 0, StringUtilities.addDoubleQuotesAroundString(alarmName));
                stepPropertyObject.SetValString("Veristand.AlarmState", 0, StringUtilities.addDoubleQuotesAroundString(alarmstate_control.SelectedItem.ToString()));
            }
            catch (System.NullReferenceException ex)
            {
                //do nothing
            }
            catch (System.IndexOutOfRangeException ex)
            {
                //do nothing
            }

            seqContext.SequenceFile.FileGlobalsDefaultValues.SetValString("Veristand.SystemDefinitionPath", 1, systemDefinitionPath_exp.Text); //Set system definition path for the Sequence File
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
            propObjectFile.IncChangeCount();                                                                                                   //Sets the flag that means the sequence has changes to save (dirty dot*)
            this.Close();
        }
 private void OK_Click(object sender, EventArgs e)
 {
     //Setting Variables this way is necessary for them to persist when TestStand Closes and is Opened again
     if (!ProcessSequenceParameters())
     {
         try
         {
             stepPropertyObject.SetValNumber("Veristand.Timeout", 0, (double)Timeout.Value);
             stepPropertyObject.SetValString("Veristand.Target", 0, target);
             seqContext.SequenceFile.FileGlobalsDefaultValues.SetValIDispatch("Veristand.StimulusProfileReference", 1, null);
             seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.StimulusProfileReference", 0, 0x4400000);
             stepPropertyObject.SetValVariant("Veristand.SequenceFilePath", 0, StringUtilities.parseFilePathString(sequenceFileExp));
             stepPropertyObject.SetValVariant("Veristand.ParamNamesArray", 0, StringUtilities.stringArrayToExpressionArray(parameterNamesArray));
             stepPropertyObject.SetValVariant("Veristand.ParamValuesArray", 0, StringUtilities.stringArrayToExpressionArray(parameterValuesArray));
             stepPropertyObject.SetValVariant("Veristand.ParamTypesArray", 0, StringUtilities.stringArrayToExpressionArray(parameterTypesArray));
             stepPropertyObject.SetValString("Veristand.NumericDataType", 0, StringUtilities.addDoubleQuotesAroundString(returnParamDataType));
             propObjectFile.IncChangeCount();  //Sets the flag that means the sequence has changes to save (dirty dot*)
         }
         catch (System.NullReferenceException ex)
         {
             //do nothing
         }
         catch (System.ArgumentNullException ex)
         {
             //do nothing
         }
         this.Close(); //Close the form
     }
     else
     {
         VSDialogs dialogs = new VSDialogs();
         dialogs.ShowWarningDialog("Please specify all Parameters.");
     }
 }
        private void treeAliasBrowserWF1_OnDblClicked(NationalInstruments.VeriStand.SystemStorage.BaseNodeType dblClickedItem)
        {
            {
                string selectedNodePath = StringUtilities.addDoubleQuotesAroundString(treeAliasBrowserWF1.GetCurrentSelection(false).NodePath);
                if (selectedNodePath == "")
                {
                }
                else
                {
                    CallingFormGlobal.selectedNodePath = selectedNodePath;
                }
                this.Close();
            }

            //private void SelectSingleChannelPanel_FormClosing(object sender, FormClosingEventArgs e)
            //{
            //    if (treeAliasBrowserWF1.GetCurrentSelections(false).Length != 0)
            //    {
            //        string selectedNodePath = StringUtilities.addDoubleQuotesAroundString(treeAliasBrowserWF1.GetCurrentSelections(false)[0].NodePath);
            //        if (selectedNodePath == "")
            //        { }
            //        else
            //        {
            //            CallingFormGlobal.selectedNodePath = selectedNodePath;
            //        }
            //    }
            //}
        }
        private void OK_Click(object sender, EventArgs e)
        {
            stepPropertyObject.SetValString("Veristand.ValueToSet", 1, value_exp.Text);
            if (channelType == ChannelType.paramChannel)
            {
                try
                {
                    stepPropertyObject.SetValString("Veristand.FullChannelPath", 0, StringUtilities.addDoubleQuotesAroundString(channel_browser.GetCurrentSelections(false)[0].NodePath));
                    //Parse the channel list name to get the proper format for a model parameter
                    string   input = channel_browser.GetCurrentSelections(false)[0].NodePath;
                    BaseNode modelNode;
                    currentSysDef.Root.FindNodeByPath(input, out modelNode);
                    string modelPath  = ((ModelParameter)modelNode).Expression;
                    Match  match      = Regex.Match(input, @"Targets/([A-Za-z0-9\-_ ()]+)/", RegexOptions.IgnoreCase);
                    string targetName = match.Groups[1].Value;
                    stepPropertyObject.SetValString("Veristand.ChannelName", 0, StringUtilities.addDoubleQuotesAroundString(modelPath));

                    stepPropertyObject.SetValString("Veristand.TargetName", 0, StringUtilities.addDoubleQuotesAroundString(targetName));
                }
                catch (System.NullReferenceException ex)
                {
                    stepPropertyObject.SetValString("Veristand.ChannelName", 0, "");
                }
                catch (System.IndexOutOfRangeException ex)
                {
                    stepPropertyObject.SetValString("Veristand.ChannelName", 0, "");
                }
            }
            else
            {
                try
                {
                    stepPropertyObject.SetValString("Veristand.ChannelName", 0, StringUtilities.addDoubleQuotesAroundString(channel_browser.GetCurrentSelections(false)[0].NodePath));
                }
                catch (System.NullReferenceException ex)
                {
                    //do nothing
                }
                catch (System.IndexOutOfRangeException ex)
                {
                    //do nothing
                }
            }
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetValString("Veristand.SystemDefinitionPath", 1, sysDefPath); //Set system definition path for this step
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
            propObjectFile.IncChangeCount();                                                                                //Sets the flag that means the sequence has changes to save (dirty dot*)
            this.Close();
        }
 public static string stringArrayToExpressionArray(string[] input)
 {
     if (input.Length > 0)
     {
         string output = "{";
         foreach (string singleString in input)
         {
             output += StringUtilities.addDoubleQuotesAroundString(singleString) + ",";
         }
         output  = output.Remove(output.Length - 1); //remove the last comma
         output += "}";
         return(output);
     }
     else
     {
         return("{\"\"}");
     }
 }
        private bool ProcessSequenceParameters()
        {
            bool errorStatus = false;

            Array.Resize(ref parameterNamesArray, 0);
            Array.Resize(ref parameterTypesArray, 0);
            Array.Resize(ref parameterValuesArray, 0);

            if (this.tableLayoutPanel1.RowCount > 1)
            {
                for (int i = 1; i < this.tableLayoutPanel1.RowCount; i++)
                {
                    //if (this.tableLayoutPanel1.GetControlFromPosition(1, i) != null && this.tableLayoutPanel1.GetControlFromPosition(2, i) != null)
                    //{
                    Label            currentNameLabel       = (Label)tableLayoutPanel1.GetControlFromPosition(0, i);
                    ComboBox         currentTypeComboBox    = (ComboBox)tableLayoutPanel1.GetControlFromPosition(1, i);
                    AxExpressionEdit currentValueExpression = (AxExpressionEdit)tableLayoutPanel1.GetControlFromPosition(2, i);
                    try
                    {
                        if (currentTypeComboBox != null & currentValueExpression != null)
                        {
                            if (currentTypeComboBox.Text != "" && currentValueExpression.Text != "")
                            {
                                insertIntoArray(ref parameterNamesArray, i - 1, StringUtilities.addDoubleQuotesAroundString(currentNameLabel.Text));
                                insertIntoArray(ref parameterTypesArray, i - 1, StringUtilities.addDoubleQuotesAroundString(currentTypeComboBox.Text.ToString()));
                                insertIntoArray(ref parameterValuesArray, i - 1, currentValueExpression.Text);
                            }

                            if (sequenceFileExp == "" || currentTypeComboBox.Text == "" || currentValueExpression.Text == "")
                            {
                                errorStatus = true;
                            }
                        }
                    }
                    catch (System.NullReferenceException ex)
                    {
                        //do nothing
                    }
                }
            }

            return(errorStatus);
        }
        private void OK_Click(object sender, EventArgs e)
        {
            stepPropertyObject.SetValString("Veristand.StimulusProfilePath", 0, StringUtilities.addDoubleQuotesAroundString(this.stimulusProfilePath_exp.Text));
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetValIDispatch("Veristand.StimulusProfileReference", 1, null);
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.StimulusProfileReference", 0, 0x4400000);

            if (!seqContext.SequenceFile.FileGlobalsDefaultValues.Exists("Veristand.GatewayIP", 0))
            {
                seqContext.SequenceFile.FileGlobalsDefaultValues.NewSubProperty("Veristand.GatewayIP", PropertyValueTypes.PropValType_NamedType, false, "Expression", 1);
                seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.GatewayIP", 0, 0x4400000);
                seqContext.SequenceFile.FileGlobalsDefaultValues.SetValString("Veristand.GatewayIP", 0, StringUtilities.addDoubleQuotesAroundString(this.gatewayIP_exp.Text));
            }
            else
            {
                seqContext.SequenceFile.FileGlobalsDefaultValues.SetValString("Veristand.GatewayIP", 0, StringUtilities.addDoubleQuotesAroundString(this.gatewayIP_exp.Text));
                seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.GatewayIP", 0, 0x4400000);
            }
            stepPropertyObject.SetValString("Veristand.UUT", 1, StringUtilities.addDoubleQuotesAroundString(this.uut_exp.Text));
            seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000);
            propObjectFile.IncChangeCount();  //Sets the flag that means the sequence has changes to save (dirty dot*)
            this.Close();
        }
        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");
            }
        }
Example #9
0
        void InitializeTableView(SequenceContext _seqContext, string fileExp, string[] _parameterValues, string[] _parameterTypes, bool reset)
        {
            //MessageBox.Show(reset.ToString());
            PropertyObject seqContextPO;

            seqContextPO = _seqContext.AsPropertyObject();
            string filePath = StringUtilities.unparseFilePathString(fileExp);

            this.OpenSelectSingleChannelsDialog = new SelectSingleChannelPanel(this);
            string[] comboBoxParameterTypes = { "Path", "Boolean", "Double", "I32", "I64", "U32", "U64" };
            this.tableLayoutPanel1.Controls.Clear();//Empty the table
            //Add in the column headers
            this.tableLayoutPanel1.Controls.Add(this.ParameterNameTitle_label, 0, 0);
            this.tableLayoutPanel1.Controls.Add(this.ParameterTypeTitle_label, 1, 0);
            this.tableLayoutPanel1.Controls.Add(this.ParameterValueTitle_label, 2, 0);
            this.tableLayoutPanel1.Controls.Add(this.SelectChannelTitle_label, 3, 0);
            this.tableLayoutPanel1.AutoSize = true;
            this.tableLayoutPanel1.RowCount = 1;
            TableLayoutRowStyleCollection rowStyles = this.tableLayoutPanel1.RowStyles;

            foreach (RowStyle style in rowStyles)
            {
                if (style.SizeType == SizeType.Percent)
                {
                    style.SizeType = SizeType.AutoSize;
                }
            }

            if (filePath != null && filePath != "" && System.IO.File.Exists(filePath))  //Don't try to initialize with a blank filepath
            {
                try
                {
                    RealTimeSequence       newRTSeq = new RealTimeSequence(filePath);
                    ParameterDeclaration[] seqParam = newRTSeq.Variables.Parameters.Variables;
                    string            parameterValueElement;
                    ReturnDeclaration returnParam     = newRTSeq.Variables.ReturnType;
                    string            returnParamType = returnParam.DataType.ToString();
                    returnParamDataType = returnParamType;

                    if (!reset)
                    {
                        this.tableLayoutPanel1.RowCount = seqParam.Length + 1; //Need rows for the header and one row for each parameter

                        if (seqParam.Length != _parameterValues.Length)
                        {
                            VSDialogs vsdialog = new VSDialogs();
                            vsdialog.ShowWarningDialog("It appears that the Real-Time Sequence has changed. Please reload the file by clicking \"Browse...\".");
                        }

                        if (seqParam.Length == _parameterValues.Length && seqParam.Length > 0 && _parameterValues.Length > 0)
                        {
                            for (int i = 0; i < seqParam.Length; i++)
                            {
                                ParameterDeclaration          param               = seqParam[i];
                                System.Windows.Forms.Label    currentNameLabel    = new System.Windows.Forms.Label();
                                System.Windows.Forms.ComboBox currentTypeComboBox = new System.Windows.Forms.ComboBox();
                                currentTypeComboBox.Enabled = false;
                                NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEdit currentExpression = new NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEdit();

                                if (param.EvaluationMethod == EvaluationMethod.ByReference)
                                {
                                    parameterValueElement = StringUtilities.removeDoubleQuotesAroundString(_parameterValues[i]);
                                    if (param.DefaultAssignment.Channel.ToString() == parameterValueElement)
                                    {
                                        int rowToAddControl = i + 1;
                                        currentNameLabel.Text     = param.Identifier;
                                        currentNameLabel.AutoSize = true;
                                        this.tableLayoutPanel1.Controls.Add(currentNameLabel, 0, rowToAddControl);
                                        currentTypeComboBox.Items.AddRange(comboBoxParameterTypes);
                                        currentTypeComboBox.SelectedValueChanged += new System.EventHandler(this.ParameterTypeChanged);

                                        currentExpression.Visible = true;
                                        currentExpression.Dock    = DockStyle.Fill;
                                        this.tableLayoutPanel1.Controls.Add(currentExpression, 2, rowToAddControl);
                                        currentExpression.Parent = tableLayoutPanel1;
                                        string handle = currentExpression.Handle.ToString();//force creation of the handle

                                        System.Windows.Forms.Button selectChannelButton = new System.Windows.Forms.Button();
                                        selectChannelButton.Text    = "Browse...";
                                        selectChannelButton.Enabled = false;
                                        selectChannelButton.Click  += new System.EventHandler(selectChannelButton_Click);
                                        selectChannelButton.Parent  = this.tableLayoutPanel1;
                                        this.tableLayoutPanel1.Controls.Add(selectChannelButton, 3, rowToAddControl);

                                        currentExpression.CreateControl();
                                        currentExpression.Context = seqContextPO;
                                        currentExpression.SyntaxHighlightingEnabled = true;
                                        currentExpression.Style    = NationalInstruments.TestStand.Interop.UI.ExpressionEditStyles.ExpressionEditStyle_Edit;
                                        currentExpression.TextType = NationalInstruments.TestStand.Interop.UI.TextTypes.TextType_Expression;
                                        currentExpression.Text     = StringUtilities.addDoubleQuotesAroundString(param.DefaultAssignment.Channel.ToString());//Just use the DefaultAssignment if they are the same.

                                        this.tableLayoutPanel1.GetControlFromPosition(3, rowToAddControl).Enabled = true;

                                        currentTypeComboBox.SelectedText = "Path";
                                        this.tableLayoutPanel1.Controls.Add(currentTypeComboBox, 1, rowToAddControl);
                                    }
                                    else
                                    {
                                        int rowToAddControl = i + 1;
                                        currentNameLabel.Text     = param.Identifier;
                                        currentNameLabel.AutoSize = true;
                                        this.tableLayoutPanel1.Controls.Add(currentNameLabel, 0, rowToAddControl);
                                        currentTypeComboBox.Items.AddRange(comboBoxParameterTypes);
                                        currentTypeComboBox.SelectedValueChanged += new System.EventHandler(this.ParameterTypeChanged);

                                        currentExpression.Visible = true;
                                        currentExpression.Dock    = DockStyle.Fill;
                                        this.tableLayoutPanel1.Controls.Add(currentExpression, 2, rowToAddControl);
                                        currentExpression.Parent = tableLayoutPanel1;
                                        string handle = currentExpression.Handle.ToString();//force creation of the handle

                                        System.Windows.Forms.Button selectChannelButton = new System.Windows.Forms.Button();
                                        selectChannelButton.Text    = "Browse...";
                                        selectChannelButton.Enabled = false;
                                        selectChannelButton.Click  += new System.EventHandler(selectChannelButton_Click);
                                        selectChannelButton.Parent  = this.tableLayoutPanel1;
                                        this.tableLayoutPanel1.Controls.Add(selectChannelButton, 3, rowToAddControl);

                                        currentExpression.CreateControl();
                                        currentExpression.Context = seqContextPO;
                                        currentExpression.SyntaxHighlightingEnabled = true;
                                        currentExpression.Style    = NationalInstruments.TestStand.Interop.UI.ExpressionEditStyles.ExpressionEditStyle_Edit;
                                        currentExpression.TextType = NationalInstruments.TestStand.Interop.UI.TextTypes.TextType_Expression;
                                        currentExpression.Text     = StringUtilities.addDoubleQuotesAroundString(parameterValueElement);//Use the value from TestStand instead of the DefaultAssignment if they are not the same.

                                        this.tableLayoutPanel1.GetControlFromPosition(3, rowToAddControl).Enabled = true;

                                        currentTypeComboBox.SelectedText = "Path";
                                        this.tableLayoutPanel1.Controls.Add(currentTypeComboBox, 1, rowToAddControl);
                                    }
                                }
                                else
                                {
                                    parameterValueElement = StringUtilities.removeDoubleQuotesAroundString(_parameterValues[i]);
                                    if (param.DefaultAssignment.ToString() == parameterValueElement)
                                    {
                                        int rowToAddControl = i + 1;
                                        currentNameLabel.Text     = param.Identifier;
                                        currentNameLabel.AutoSize = true;
                                        this.tableLayoutPanel1.Controls.Add(currentNameLabel, 0, rowToAddControl);
                                        currentTypeComboBox.Items.AddRange(comboBoxParameterTypes);
                                        currentTypeComboBox.SelectedValueChanged += new System.EventHandler(this.ParameterTypeChanged);

                                        currentExpression.Visible = true;
                                        currentExpression.Dock    = DockStyle.Fill;
                                        this.tableLayoutPanel1.Controls.Add(currentExpression, 2, rowToAddControl);
                                        currentExpression.Parent = tableLayoutPanel1;
                                        string handle = currentExpression.Handle.ToString();//force creation of the handle

                                        System.Windows.Forms.Button selectChannelButton = new System.Windows.Forms.Button();
                                        selectChannelButton.Text    = "Browse...";
                                        selectChannelButton.Enabled = false;
                                        selectChannelButton.Click  += new System.EventHandler(selectChannelButton_Click);
                                        selectChannelButton.Parent  = this.tableLayoutPanel1;
                                        this.tableLayoutPanel1.Controls.Add(selectChannelButton, 3, rowToAddControl);

                                        currentExpression.CreateControl();
                                        currentExpression.Context = seqContextPO;
                                        currentExpression.SyntaxHighlightingEnabled = true;
                                        currentExpression.Style    = NationalInstruments.TestStand.Interop.UI.ExpressionEditStyles.ExpressionEditStyle_Edit;
                                        currentExpression.TextType = NationalInstruments.TestStand.Interop.UI.TextTypes.TextType_Expression;
                                        currentExpression.Text     = param.DefaultAssignment.ToString();//Just use the DefaultAssignment if they are the same.

                                        this.tableLayoutPanel1.GetControlFromPosition(3, rowToAddControl).Enabled = false;
                                        switch (param.DefaultValue.Type.ToString())
                                        {
                                        case "Double":
                                            currentTypeComboBox.SelectedText = "Double";
                                            break;

                                        case "UInt64":
                                            currentTypeComboBox.SelectedText = "U64";
                                            break;

                                        case "Int64":
                                            currentTypeComboBox.SelectedText = "I64";
                                            break;

                                        case "UInt32":
                                            currentTypeComboBox.SelectedText = "U32";
                                            break;

                                        case "Int32":
                                            currentTypeComboBox.SelectedText = "I32";
                                            break;

                                        case "Boolean":
                                            currentTypeComboBox.SelectedText = "Boolean";
                                            break;
                                        }
                                        this.tableLayoutPanel1.Controls.Add(currentTypeComboBox, 1, rowToAddControl);
                                    }
                                    else
                                    {
                                        int rowToAddControl = i + 1;
                                        currentNameLabel.Text     = param.Identifier;
                                        currentNameLabel.AutoSize = true;
                                        this.tableLayoutPanel1.Controls.Add(currentNameLabel, 0, rowToAddControl);
                                        currentTypeComboBox.Items.AddRange(comboBoxParameterTypes);
                                        currentTypeComboBox.SelectedValueChanged += new System.EventHandler(this.ParameterTypeChanged);

                                        currentExpression.Visible = true;
                                        currentExpression.Dock    = DockStyle.Fill;
                                        this.tableLayoutPanel1.Controls.Add(currentExpression, 2, rowToAddControl);
                                        currentExpression.Parent = tableLayoutPanel1;
                                        string handle = currentExpression.Handle.ToString();//force creation of the handle

                                        System.Windows.Forms.Button selectChannelButton = new System.Windows.Forms.Button();
                                        selectChannelButton.Text    = "Browse...";
                                        selectChannelButton.Enabled = false;
                                        selectChannelButton.Click  += new System.EventHandler(selectChannelButton_Click);
                                        selectChannelButton.Parent  = this.tableLayoutPanel1;
                                        this.tableLayoutPanel1.Controls.Add(selectChannelButton, 3, rowToAddControl);

                                        currentExpression.CreateControl();
                                        currentExpression.Context = seqContextPO;
                                        currentExpression.SyntaxHighlightingEnabled = true;
                                        currentExpression.Style    = NationalInstruments.TestStand.Interop.UI.ExpressionEditStyles.ExpressionEditStyle_Edit;
                                        currentExpression.TextType = NationalInstruments.TestStand.Interop.UI.TextTypes.TextType_Expression;
                                        currentExpression.Text     = parameterValueElement;//Use the value from TestStand instead of the DefaultAssignment if they are not the same.

                                        this.tableLayoutPanel1.GetControlFromPosition(3, rowToAddControl).Enabled = false;
                                        switch (param.DefaultValue.Type.ToString())
                                        {
                                        case "Double":
                                            currentTypeComboBox.SelectedText = "Double";
                                            break;

                                        case "UInt64":
                                            currentTypeComboBox.SelectedText = "U64";
                                            break;

                                        case "Int64":
                                            currentTypeComboBox.SelectedText = "I64";
                                            break;

                                        case "UInt32":
                                            currentTypeComboBox.SelectedText = "U32";
                                            break;

                                        case "Int32":
                                            currentTypeComboBox.SelectedText = "I32";
                                            break;

                                        case "Boolean":
                                            currentTypeComboBox.SelectedText = "Boolean";
                                            break;
                                        }
                                        this.tableLayoutPanel1.Controls.Add(currentTypeComboBox, 1, rowToAddControl);
                                    }
                                    //switch (param.DefaultValue.Type.ToString())
                                    //{
                                    //    case "Double":
                                    //        currentTypeComboBox.SelectedText = "Double";
                                    //        break;
                                    //    case "UInt64":
                                    //        currentTypeComboBox.SelectedText = "U64";
                                    //        break;
                                    //    case "Int64":
                                    //        currentTypeComboBox.SelectedText = "I64";
                                    //        break;
                                    //    case "UInt32":
                                    //        currentTypeComboBox.SelectedText = "U32";
                                    //        break;
                                    //    case "Int32":
                                    //        currentTypeComboBox.SelectedText = "I32";
                                    //        break;
                                    //    case "Boolean":
                                    //        currentTypeComboBox.SelectedText = "Boolean";
                                    //        break;
                                    //}
                                }
                            }
                        }
                    }

                    if (reset)
                    {
                        this.tableLayoutPanel1.RowCount = seqParam.Length + 1; //Need rows for the header and one row for each parameter

                        if (seqParam.Length > 0)
                        {
                            this.tableLayoutPanel1.AutoSize = true;
                            int n = 1;

                            foreach (ParameterDeclaration param in seqParam)
                            {
                                System.Windows.Forms.Label currentNameLabel = new System.Windows.Forms.Label();
                                currentNameLabel.Text     = param.Identifier;
                                currentNameLabel.AutoSize = true;
                                this.tableLayoutPanel1.Controls.Add(currentNameLabel, 0, n);
                                System.Windows.Forms.ComboBox currentTypeComboBox = new System.Windows.Forms.ComboBox();
                                currentTypeComboBox.Items.AddRange(comboBoxParameterTypes);
                                currentTypeComboBox.SelectedValueChanged += new System.EventHandler(this.ParameterTypeChanged);
                                currentTypeComboBox.Enabled = false;
                                NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEdit currentExpression = new NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEdit();
                                currentExpression.Visible = true;
                                currentExpression.Dock    = DockStyle.Fill;
                                this.tableLayoutPanel1.Controls.Add(currentExpression, 2, n);
                                currentExpression.Parent = tableLayoutPanel1;
                                string handle = currentExpression.Handle.ToString();//force creation of the handle
                                System.Windows.Forms.Button selectChannelButton = new System.Windows.Forms.Button();
                                selectChannelButton.Text    = "Browse...";
                                selectChannelButton.Enabled = false;
                                selectChannelButton.Click  += new System.EventHandler(selectChannelButton_Click);
                                selectChannelButton.Parent  = this.tableLayoutPanel1;
                                this.tableLayoutPanel1.Controls.Add(selectChannelButton, 3, n);
                                currentExpression.CreateControl();
                                currentExpression.Context = seqContextPO;
                                currentExpression.SyntaxHighlightingEnabled = true;
                                currentExpression.Style    = NationalInstruments.TestStand.Interop.UI.ExpressionEditStyles.ExpressionEditStyle_Edit;
                                currentExpression.TextType = NationalInstruments.TestStand.Interop.UI.TextTypes.TextType_Expression;


                                if (param.EvaluationMethod == EvaluationMethod.ByReference)
                                {
                                    currentTypeComboBox.SelectedText = "Path";
                                    currentExpression.Text           = StringUtilities.addDoubleQuotesAroundString(param.DefaultAssignment.Channel.ToString());
                                    this.tableLayoutPanel1.GetControlFromPosition(3, n).Enabled = true;
                                }
                                else
                                {
                                    switch (param.DefaultValue.Type.ToString())
                                    {
                                    case "Double":
                                        currentTypeComboBox.SelectedText = "Double";
                                        break;

                                    case "UInt64":
                                        currentTypeComboBox.SelectedText = "U64";
                                        break;

                                    case "Int64":
                                        currentTypeComboBox.SelectedText = "I64";
                                        break;

                                    case "UInt32":
                                        currentTypeComboBox.SelectedText = "U32";
                                        break;

                                    case "Int32":
                                        currentTypeComboBox.SelectedText = "I32";
                                        break;

                                    case "Boolean":
                                        currentTypeComboBox.SelectedText = "Boolean";
                                        break;
                                    }
                                    currentExpression.Text = param.DefaultAssignment.ToString();
                                }
                                this.tableLayoutPanel1.Controls.Add(currentTypeComboBox, 1, n);
                                n++;
                            }
                        }
                    }
                }

                catch (System.ArgumentException)
                {
                    VSDialogs dialogs = new VSDialogs();
                    dialogs.ShowWarningDialog("Invalid Filepath:" + filePath);
                }
            }
        }
        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 = "";
            }
        }