Exemplo n.º 1
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, "");
            }

            //create variable editing form
            Supplement_Forms.frmAddVariable addVariableForm = new Supplement_Forms.frmAddVariable(VariableName, VariableValue);
            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);
            }
        }
Exemplo n.º 2
0
        private void uiBtnNew_Click(object sender, EventArgs e)
        {
            //create variable editing form
            Supplement_Forms.frmAddVariable addVariableForm = new Supplement_Forms.frmAddVariable();
            ExpandUserVariableNode();

            //validate if user added variable
            if (addVariableForm.ShowDialog() == DialogResult.OK)
            {
                //add newly edited node
                AddUserVariableNode(userVariableParentNode, addVariableForm.txtVariableName.Text, addVariableForm.txtDefaultValue.Text);
            }
        }