示例#1
0
        private void uiBtnNew_Click(object sender, EventArgs e)
        {
            //create variable editing form
            frmAddVariable addVariableForm = new frmAddVariable();

            addVariableForm.ScriptVariables = ScriptVariables;

            ExpandUserVariableNode();

            //validate if user added variable
            if (addVariableForm.ShowDialog() == DialogResult.OK)
            {
                //add newly edited node
                AddUserVariableNode(_userVariableParentNode, addVariableForm.txtVariableName.Text, addVariableForm.txtDefaultValue.Text);
                LastModifiedVariableName = addVariableForm.txtVariableName.Text;
            }
        }
示例#2
0
        private void uiBtnNew_Click(object sender, EventArgs e)
        {
            //create variable editing form
            frmAddVariable addVariableForm = new frmAddVariable(_typeContext);

            addVariableForm.ScriptContext = ScriptContext;
            addVariableForm.VariablesCopy = _variablesCopy;

            ExpandUserVariableNode();

            //validate if user added variable
            if (addVariableForm.ShowDialog() == DialogResult.OK)
            {
                //add newly edited node
                AddUserVariableNode(_userVariableParentNode, addVariableForm.txtVariableName.Text, addVariableForm.txtDefaultValue.Text,
                                    (Type)addVariableForm.cbxDefaultType.Tag);
                LastModifiedVariableName = addVariableForm.txtVariableName.Text;
                ResetVariables();
            }

            addVariableForm.Dispose();
        }
示例#3
0
        private void tvScriptVariables_DoubleClick(object sender, EventArgs e)
        {
            //handle double clicks outside
            if (tvScriptVariables.SelectedNode == null)
            {
                return;
            }

            //if parent was selected return
            if (tvScriptVariables.SelectedNode.Parent == null)
            {
                //user selected top parent
                return;
            }

            //top node check
            var topNode = GetSelectedTopNode();

            if (topNode.Text != "My Task Variables")
            {
                return;
            }

            string   VariableName, VariableValue;
            TreeNode parentNode;

            if (tvScriptVariables.SelectedNode.Nodes.Count == 0)
            {
                parentNode    = tvScriptVariables.SelectedNode.Parent;
                VariableName  = tvScriptVariables.SelectedNode.Parent.Text;
                VariableValue = tvScriptVariables.SelectedNode.Text.Replace(_leadingValue, "").Replace(_emptyValue, "");
            }
            else
            {
                parentNode    = tvScriptVariables.SelectedNode;
                VariableName  = tvScriptVariables.SelectedNode.Text;
                VariableValue = tvScriptVariables.SelectedNode.Nodes[0].Text.Replace(_leadingValue, "").Replace(_emptyValue, "");
            }

            if (VariableName.Replace("{", "").Replace("}", "") == "ProjectPath")
            {
                return;
            }

            //create variable editing form
            frmAddVariable addVariableForm = new frmAddVariable(VariableName, VariableValue);

            addVariableForm.ScriptVariables = ScriptVariables;

            ExpandUserVariableNode();

            //validate if user added variable
            if (addVariableForm.ShowDialog() == DialogResult.OK)
            {
                //remove parent
                parentNode.Remove();

                //add newly edited node
                AddUserVariableNode(_userVariableParentNode, addVariableForm.txtVariableName.Text, addVariableForm.txtDefaultValue.Text);
                LastModifiedVariableName = addVariableForm.txtVariableName.Text;
            }
        }
示例#4
0
        private void tvScriptVariables_DoubleClick(object sender, EventArgs e)
        {
            //handle double clicks outside
            if (tvScriptVariables.SelectedNode == null)
            {
                return;
            }

            //if parent was selected return
            if (tvScriptVariables.SelectedNode.Parent == null)
            {
                //user selected top parent
                return;
            }

            //top node check
            var topNode = GetSelectedTopNode();

            if (topNode.Text != "My Task Variables")
            {
                return;
            }

            string   variableName, variableValue;
            Type     variableType;
            TreeNode parentNode;

            if (tvScriptVariables.SelectedNode.Nodes.Count == 0)
            {
                parentNode    = tvScriptVariables.SelectedNode.Parent;
                variableName  = tvScriptVariables.SelectedNode.Parent.Text;
                variableValue = tvScriptVariables.SelectedNode.Parent.Nodes[0].Text.Replace(_leadingValue, "").Replace(_emptyValue, "");
                variableType  = (Type)tvScriptVariables.SelectedNode.Parent.Nodes[1].Tag;
            }
            else
            {
                parentNode    = tvScriptVariables.SelectedNode;
                variableName  = tvScriptVariables.SelectedNode.Text;
                variableValue = tvScriptVariables.SelectedNode.Nodes[0].Text.Replace(_leadingValue, "").Replace(_emptyValue, "");
                variableType  = (Type)tvScriptVariables.SelectedNode.Nodes[1].Tag;
            }

            if (variableName == "ProjectPath")
            {
                return;
            }

            //create variable editing forms
            frmAddVariable addVariableForm = new frmAddVariable(variableName, variableValue, variableType, _typeContext);

            addVariableForm.ScriptContext = ScriptContext;
            addVariableForm.VariablesCopy = _variablesCopy;

            ExpandUserVariableNode();

            //validate if user added variable
            if (addVariableForm.ShowDialog() == DialogResult.OK)
            {
                //remove parent
                parentNode.Remove();

                //add newly edited node
                AddUserVariableNode(_userVariableParentNode, addVariableForm.txtVariableName.Text, addVariableForm.txtDefaultValue.Text,
                                    (Type)addVariableForm.cbxDefaultType.Tag);
                LastModifiedVariableName = addVariableForm.txtVariableName.Text;
                ResetVariables();
            }

            addVariableForm.Dispose();
        }