Example #1
0
        // --- 创建文件夹 ---
        private void ToolStripMenuItem_CreateFloder_Click(object sender, EventArgs e)
        {
            // 获得父节点
            TreeNode tParent = treeView_Main.SelectedNode;

            if (tParent != null)
            {
                // 检查父节点
                if (!((FCYResPackageNode)tParent.Tag).IsFloder())
                {
                    showErr("请选择一个文件夹节点。");
                    return;
                }

                // 获得父节点
                FCYResPackageFloderNode tParentFloder = (FCYResPackageFloderNode)tParent.Tag;

                // 获得新节点名称
                string tNodeName = "";
                if (!CreateFloderForm.OpenCreateFloderForm(treeView_Main.SelectedNode.FullPath, ref tNodeName))
                {
                    return;
                }

                if (tNodeName == "")
                {
                    showErr("无效的名称。");
                    return;
                }

                // 创建节点
                FCYResPackageFloderNode tNewSubNode = new FCYResPackageFloderNode(tParentFloder, tNodeName);

                // 尝试加入
                try
                {
                    tParentFloder.Add(tNewSubNode);
                }
                catch
                {
                    showErr("节点名已存在或者无效。");
                    return;
                }

                // 创建树节点
                TreeNode tTreeNode = new TreeNode(tNodeName, 0, 0);
                tTreeNode.Tag = tNewSubNode;

                // 加入
                tParent.Nodes.Add(tTreeNode);
                tParent.Expand();
            }
        }
Example #2
0
        static public bool OpenCreateFloderForm(string Path, ref string NodeName)
        {
            CreateFloderForm tForm = new CreateFloderForm(Path);

            if (tForm.ShowDialog() == DialogResult.Cancel)
            {
                tForm.Dispose();
                return(false);
            }
            else
            {
                NodeName = tForm.textBox2.Text;
                tForm.Dispose();
                return(true);
            }
        }
Example #3
0
        public static bool OpenCreateFloderForm(string Path, ref string NodeName)
        {
            CreateFloderForm tForm = new CreateFloderForm(Path);

            if (tForm.ShowDialog() == DialogResult.Cancel)
            {
                tForm.Dispose();
                return false;
            }
            else
            {
                NodeName = tForm.textBox2.Text;
                tForm.Dispose();
                return true;
            }
        }