private void btn_new_Click(object sender, EventArgs e)
 {
     New_Section ns = new New_Section();
     ns.ShowDialog();
     string[] sections = ns.Sections;
     foreach (string s in sections)
     {
         bool exists = false;
         for (int i = 0; i <dgv_section_titles.Rows.Count; i++)
         {
             if (dgv_section_titles.Rows[i].Cells[0].Value.ToString() == s)
             {
                 exists = true;
             }
         }
         if (!exists)
         {
             dgv_section_titles.Rows.Add(s);
         }
     }
     if (dgv_section_titles.RowCount > 0)
     {
         dgv_section_titles.Rows[0].Cells[0].Selected = false;
     }
 }
Пример #2
0
 private void newSectionToolStripButton_Click(object sender, EventArgs e)
 {
     New_Section section = new New_Section();
     section.ShowDialog();
     bool exists = false;
     for (int i = 0; i < trv_explorer.Nodes[0].Nodes.Count; i++)
     {
         if (trv_explorer.Nodes[0].Nodes[i].Text == section.SectionName)
         {
             exists = true;
         }
     }
     if (!exists)
     {
         TreeNode secNode = new TreeNode();
         secNode.Name = "sectionNode" + (trv_explorer.Nodes[0].Nodes.Count);
         secNode.Text = section.SectionName;
         secNode.ImageIndex = 1;
         secNode.SelectedImageIndex = 1;
         secNode.ContextMenuStrip = cms_explorer;
         trv_explorer.Nodes[0].Nodes.Add(secNode);
     }
     trv_explorer.ExpandAll();
 }
Пример #3
0
 private void AddSection(object sender, EventArgs e)
 {
     New_Section ns = new New_Section();
     ns.ShowDialog();
     string[] newSections = ns.Sections;
     foreach (string section in newSections)
     {
         bool exists = false;
         for (int i = 0; i < trv_explorer.Nodes[0].Nodes.Count; i++)
         {
             if (trv_explorer.Nodes[0].Nodes[i].Text == section)
             {
                 exists = true;
             }
         }
         if (!exists)
         {
             TreeNode node = new TreeNode();
             node.Name = "secNode" + (trv_explorer.SelectedNode.Nodes.Count);
             node.Text = section;
             node.ImageIndex = 0;
             node.SelectedImageIndex = 0;
             node.ContextMenuStrip = contextMenuStrip;
             trv_explorer.SelectedNode.Nodes.Add(node);
         }
     }
     trv_explorer.ExpandAll();
 }