private void uiBtnNew_Click(object sender, EventArgs e)
        {
            //create element editing form
            frmAddElement addElementForm = new frmAddElement();

            addElementForm.ScriptContext = ScriptContext;
            addElementForm.ElementsCopy  = _elementsCopy;

            ExpandUserElementNode();

            //validate if user added element
            if (addElementForm.ShowDialog() == DialogResult.OK)
            {
                //add newly edited node
                AddUserElementNode(_userElementParentNode, addElementForm.txtElementName.Text, addElementForm.ElementValueDT);

                _elementsCopy.Add(new ScriptElement
                {
                    ElementName  = addElementForm.txtElementName.Text,
                    ElementValue = addElementForm.ElementValueDT
                });
            }

            addElementForm.Dispose();
        }
        private void tvScriptElements_DoubleClick(object sender, EventArgs e)
        {
            //handle double clicks outside
            if (tvScriptElements.SelectedNode == null)
            {
                return;
            }

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

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

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

            ScriptElement element;
            string        elementName;
            DataTable     elementValue;
            TreeNode      parentNode;

            if (tvScriptElements.SelectedNode.Nodes.Count == 0)
            {
                parentNode  = tvScriptElements.SelectedNode.Parent;
                elementName = tvScriptElements.SelectedNode.Parent.Text;
            }
            else
            {
                parentNode  = tvScriptElements.SelectedNode;
                elementName = tvScriptElements.SelectedNode.Text;
            }

            element      = _elementsCopy.Where(x => x.ElementName == elementName).FirstOrDefault();
            elementValue = element.ElementValue;

            //create element editing form
            frmAddElement addElementForm = new frmAddElement(elementName, elementValue);

            addElementForm.ScriptContext = ScriptContext;
            addElementForm.ElementsCopy  = _elementsCopy;

            ExpandUserElementNode();

            //validate if user added element
            if (addElementForm.ShowDialog() == DialogResult.OK)
            {
                //remove parent
                parentNode.Remove();
                AddUserElementNode(_userElementParentNode, addElementForm.txtElementName.Text, addElementForm.ElementValueDT);
            }

            addElementForm.Dispose();
        }