private void 根目录ToolStripMenuItem_Click(object sender, EventArgs e) { string inputStr = Interaction.InputBox("请输入根目录名称", "根目录", "目录名", -1, -1); inputStr = inputStr.Trim(); if (inputStr.Length < 1) { //MessageBox.Show("您输入的目录名为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } foreach (TreeNode node in treeView.Nodes) { if (node.Text == inputStr) { MessageBox.Show("目录名不能重复!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } this.treeView.Nodes.Add(inputStr); SKnowledgeNode rnode = new SKnowledgeNode(); rnode.name = inputStr; rnode.isNode = true; rnode.index.Add(m_Tree.Count + 1); rnode.filePath = sTreeDir + rnode.name + "/"; rnode.createFilePath(); m_Tree.Add(rnode); serializeTree(); }
public SKnowledgeNode() { name = ""; index = new List <int>(); isNode = false; isLeaf = false; filePath = ""; parent = null; childs = new List <SKnowledgeNode>(); guid = Guid.NewGuid().ToString(); }