Exemplo n.º 1
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (this._editorNode != null)
         {
             this._editorNode.CloseEditor();
             this._editorNode = null;
         }
         if (this.ToolStripItem != null)
         {
             this.ToolStripItem.Paint -= new PaintEventHandler(this.OnItemPaint);
         }
         IComponentChangeService service = (IComponentChangeService)this.GetService(typeof(IComponentChangeService));
         if (service != null)
         {
             service.ComponentRename -= new ComponentRenameEventHandler(this.OnComponentRename);
         }
         if (this.selSvc != null)
         {
             this.selSvc.SelectionChanged -= new EventHandler(this.OnSelectionChanged);
         }
         if (this.bodyGlyph != null)
         {
             ToolStripAdornerWindowService service2 = (ToolStripAdornerWindowService)this.GetService(typeof(ToolStripAdornerWindowService));
             if ((service2 != null) && service2.DropDownAdorner.Glyphs.Contains(this.bodyGlyph))
             {
                 service2.DropDownAdorner.Glyphs.Remove(this.bodyGlyph);
             }
         }
         if ((this.toolStripItemCustomMenuItemCollection != null) && (this.toolStripItemCustomMenuItemCollection.Count > 0))
         {
             foreach (System.Windows.Forms.ToolStripItem item in this.toolStripItemCustomMenuItemCollection)
             {
                 item.Dispose();
             }
             this.toolStripItemCustomMenuItemCollection.Clear();
         }
         this.toolStripItemCustomMenuItemCollection = null;
     }
     base.Dispose(disposing);
 }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (this._editorNode != null)
         {
             this._editorNode.CloseEditor();
             this._editorNode = null;
         }
         if (this.ToolStripItem != null)
         {
             this.ToolStripItem.Paint -= new PaintEventHandler(this.OnItemPaint);
         }
         IComponentChangeService service = (IComponentChangeService) this.GetService(typeof(IComponentChangeService));
         if (service != null)
         {
             service.ComponentRename -= new ComponentRenameEventHandler(this.OnComponentRename);
         }
         if (this.selSvc != null)
         {
             this.selSvc.SelectionChanged -= new EventHandler(this.OnSelectionChanged);
         }
         if (this.bodyGlyph != null)
         {
             ToolStripAdornerWindowService service2 = (ToolStripAdornerWindowService) this.GetService(typeof(ToolStripAdornerWindowService));
             if ((service2 != null) && service2.DropDownAdorner.Glyphs.Contains(this.bodyGlyph))
             {
                 service2.DropDownAdorner.Glyphs.Remove(this.bodyGlyph);
             }
         }
         if ((this.toolStripItemCustomMenuItemCollection != null) && (this.toolStripItemCustomMenuItemCollection.Count > 0))
         {
             foreach (System.Windows.Forms.ToolStripItem item in this.toolStripItemCustomMenuItemCollection)
             {
                 item.Dispose();
             }
             this.toolStripItemCustomMenuItemCollection.Clear();
         }
         this.toolStripItemCustomMenuItemCollection = null;
     }
     base.Dispose(disposing);
 }