private void OnSectionRemoved(object sender, ToolboxSectionEventArgs e) { ToolboxSection section = e.Section; int index = -1; for (int i = this._sections.Count - 1; i >= 0; i--) { if (((SectionInfo) this._sections[i]).ToolboxSection == section) { index = i; break; } } if (index == -1) { throw new ArgumentException("Unknown section"); } section.ItemsChanged -= new EventHandler(this.OnToolboxSectionItemsChanged); this._groupView.Sections.Remove(((SectionInfo) this._sections[index]).UISection); this._sections.RemoveAt(index); }
private void OnActiveSectionChanged(object sender, ToolboxSectionEventArgs e) { if (!this._internalChange) { ToolboxSection section = e.Section; if (this.CurrentSection != section) { this.CurrentSection = section; SectionInfo info = null; foreach (SectionInfo info2 in this._sections) { if (info2.ToolboxSection == section) { info = info2; break; } } this._groupView.SelectedSection = info.UISection; } } }
private void OnSectionAdded(object sender, ToolboxSectionEventArgs e) { ToolboxSection section = e.Section; this._groupViewImages.Images.Add(section.Icon); GroupViewSection section2 = new GroupViewSection(); section2.ImageIndex = this._groupViewImages.Images.Count - 1; section2.Text = section.Name; section2.Visible = false; foreach (ToolboxDataItem item in section.ToolboxDataItems) { ToolboxDataGroupViewItem item2 = new ToolboxDataGroupViewItem(item, this); section2.Items.Add(item2); } SectionInfo info = new SectionInfo(); info.ToolboxSection = section; info.UISection = section2; this._sections.Add(info); this._groupView.Sections.Add(section2); section.ItemsChanged += new EventHandler(this.OnToolboxSectionItemsChanged); this.UpdateToolboxClient(); }
private void OnActiveSectionChanged(object sender, ToolboxSectionEventArgs e) { if (this._activeSectionChangedHandler != null) { this._activeSectionChangedHandler(this, e); } }