Example #1
0
        /// <summary>
        /// block名称修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolBlockNameEdit_Click(object sender, EventArgs e)
        {
            //定义块新增控制的委托
            Func <string, bool> editBlock = (newblockName) =>
            {
                string blockName = treeTags.SelectedNode.Text;
                string groupName = treeTags.SelectedNode.Parent.Text;
                if (TagConfig.EditBlock(groupName, blockName, newblockName))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            };
            ControlBlock ab = new ControlBlock(editBlock, treeTags.SelectedNode.Text);

            if (ab.ShowDialog() == DialogResult.OK)
            {
                //清空后并重新加载
                treeTags.Nodes.Clear();
                XElement doc = XElement.Load(TagConfig.Path); //将加载完成的XML文件显示在TreeView控件中
                RecursionTreeControl(doc, treeTags.Nodes);
                treeTags.ExpandAll();                         //展开TreeView控件中的所有项
                lblBlock.Text = ab.NewBlockName;
            }
        }
Example #2
0
        //新增block
        private void toolBlockAdd_Click(object sender, EventArgs e)
        {
            //定义块新增控制的委托
            Func <string, bool> addBlock = (blockName) =>
            {
                if (TagConfig.CreateBlock(treeTags.SelectedNode.Text, blockName))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            };
            ControlBlock ab = new ControlBlock(addBlock);

            if (ab.ShowDialog() == DialogResult.OK)
            {
                //清空后并重新加载
                treeTags.Nodes.Clear();
                XElement doc = XElement.Load(TagConfig.Path); //将加载完成的XML文件显示在TreeView控件中
                RecursionTreeControl(doc, treeTags.Nodes);
                treeTags.ExpandAll();                         //展开TreeView控件中的所有项
            }
        }