示例#1
0
        void EditSection_Click(object sender, EventArgs e)
        {
            ToolStripItem item = sender as ToolStripItem;
            NodeData nodeData = item.Tag as NodeData;

            Section section = _iTunes.GetSection(nodeData.Handle);

            EditSection editSection = new EditSection();
            editSection.SectionName= section.Name;

            if (editSection.ShowDialog(this) == DialogResult.OK)
            {
                section.Name = editSection.SectionName;

                _iTunes.MergeSection(nodeData.Handle, section);

                nodeData.TreeNode.Text = section.Name;
            }

            editSection.Dispose();
        }
示例#2
0
        void AddSectionToSite_Click(object sender, EventArgs e)
        {
            ToolStripItem item = sender as ToolStripItem;
            NodeData nodeData = item.Tag as NodeData;

            EditSection editSection = new EditSection();
            editSection.SectionName = "";

            if (editSection.ShowDialog(this) == DialogResult.OK)
            {
                Section section = new Section();
                section.Name = editSection.SectionName;

                string newHandle = _iTunes.AddSection(nodeData.Handle, section);

                // create new tree node
                TreeNode sectionNode = new TreeNode();
                sectionNode.Text = section.Name;
                sectionNode.Tag = new NodeData("Section", newHandle, sectionNode);

                nodeData.TreeNode.Nodes.Add(sectionNode);
            }

            editSection.Dispose();
        }