private void EditItem() { Boolean Result = true; TreeNode Node = DictionaryView.SelectedNode; DictionaryReferenceItemEditor ItemEditor = new DictionaryReferenceItemEditor(Node); if (DialogResult.OK == ItemEditor.ShowDialog()) { foreach (TreeNode SubNode in Node.Nodes) { Result = Result && DictionaryManager.DeleteDictionary(SubNode); } Node.Nodes.Clear(); String[] Lines = ItemEditor.TextBox_Items.Lines; foreach (String Line in Lines) { if (string.IsNullOrEmpty(Line)) { continue; } TreeNode SubNode = new TreeNode(); String Code = DictionaryManager.GetNextCode(Node.Name); SubNode.Name = Code; SubNode.Text = Line; SubNode.SelectedImageIndex = 1; SubNode.ImageIndex = 1; Selection sele = new Selection(); sele.TypeFlag = "@DictionaryItem"; sele.ID = Guid.NewGuid().ToString(); sele.Code = Node.Name; sele.Value = Code; SubNode.Tag = sele; Node.Nodes.Add(SubNode); } if (Node.Nodes.Count > 0) { Result = Result & DictionaryManager.SaveDictionary(DictionaryView.Nodes[0]); } if (!Result) { MessageBox.Show("保存字典失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void DeleteFolder() { Boolean Result = false; TreeNode node = DictionaryView.SelectedNode; Result = DictionaryManager.DeleteDictionary(node); if (Result) { node.Remove(); MessageBox.Show("已删除字典分类"); } else { MessageBox.Show("删除失败"); } }