Пример #1
0
        private void addChildToolStripMenuItem_Click(object sender, EventArgs e)
        {
            (new CommonManager()).BeginBatchOperation();
            CommonEditor commonEditor  = new CommonEditor();
            string       candidateName =
                commonEditor.GetValue("Item name", typeof(string), string.Empty, true, (new ItemManager()).GetNamesOfItems());

            if (candidateName.Length > 0)
            {
                if (treeView1.SelectedNode.Level == 0)
                {
                    am.AddChild((new ItemManager()).GetItemByName(candidateName), null);
                }
                else
                {
                    am.AddChild(
                        (new ItemManager()).GetItemByName(treeView1.SelectedNode.Text),
                        (new ItemManager()).GetItemByName(candidateName));
                }
            }
            (new CommonManager()).ConfirmBatchOperation();
            BuildTree();
        }