예제 #1
0
        private void NewFolder()
        {
            TreeNode ParentNode = DictionaryView.SelectedNode;
            TreeNode Node       = new TreeNode();
            String   Code       = DictionaryManager.GetNextCode(ParentNode.Name);

            Node.Name = Code;
            Node.Text = "新建分类";
            Node.SelectedImageIndex = 0;
            Node.ImageIndex         = 0;
            Selection sele = new Selection();

            sele.TypeFlag = "@Dictionary";
            sele.ID       = Guid.NewGuid().ToString();
            sele.Code     = null;
            sele.Value    = Code;
            Node.Tag      = sele;

            ParentNode.Nodes.Add(Node);
            Boolean Result = DictionaryManager.SaveDictionary(DictionaryView.Nodes[0]);

            if (!Result)
            {
                MessageBox.Show("字典配置保存失败");
                Node.Remove();
            }
        }
예제 #2
0
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            Boolean Result   = DictionaryManager.SaveDictionary(DictionaryView.Nodes[0]);
            String  Messsage = (Result ? "字典配置保存完成" : "字典配置保存失败");

            MessageBox.Show(Messsage);
        }
예제 #3
0
        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);
                }
            }
        }