public void ShowMenu()
 {
     if (this.menuItem != null)
     {
         Control parent = this.designMenu.Parent;
         Form component = parent as Form;
         if (component != null)
         {
             this.parentFormDesigner = this.host.GetDesigner(component) as FormDocumentDesigner;
             if ((this.parentFormDesigner != null) && (this.parentFormDesigner.Menu != null))
             {
                 this.parentMenu = this.parentFormDesigner.Menu;
                 this.parentFormDesigner.Menu = null;
             }
         }
         this.selected = true;
         this.designMenu.Visible = true;
         this.designMenu.BringToFront();
         this.menuItem.Visible = true;
         if ((this.currentParent != null) && (this.currentParent != this.menuItem))
         {
             ToolStripMenuItemDesigner designer = this.host.GetDesigner(this.currentParent) as ToolStripMenuItemDesigner;
             if (designer != null)
             {
                 designer.RemoveTypeHereNode(this.currentParent);
             }
         }
         this.menuItem.DropDown = this.dropDown;
         this.menuItem.DropDown.OwnerItem = this.menuItem;
         if (this.dropDown.Items.Count > 0)
         {
             ToolStripItem[] array = new ToolStripItem[this.dropDown.Items.Count];
             this.dropDown.Items.CopyTo(array, 0);
             foreach (ToolStripItem item in array)
             {
                 if (item is DesignerToolStripControlHost)
                 {
                     this.dropDown.Items.Remove(item);
                 }
             }
         }
         ToolStripMenuItemDesigner designer2 = (ToolStripMenuItemDesigner) this.host.GetDesigner(this.menuItem);
         BehaviorService service = (BehaviorService) this.GetService(typeof(BehaviorService));
         if (service != null)
         {
             if ((designer2 != null) && (parent != null))
             {
                 Rectangle parentBounds = service.ControlRectInAdornerWindow(parent);
                 if (ToolStripDesigner.IsGlyphTotallyVisible(service.ControlRectInAdornerWindow(this.designMenu), parentBounds))
                 {
                     designer2.InitializeDropDown();
                 }
             }
             if (this.dummyToolStripGlyph == null)
             {
                 Point pos = service.ControlToAdornerWindow(this.designMenu);
                 Rectangle bounds = this.designMenu.Bounds;
                 bounds.Offset(pos);
                 this.dummyToolStripGlyph = new ControlBodyGlyph(bounds, Cursor.Current, this.menuItem, new ContextMenuStripBehavior(this.menuItem));
                 SelectionManager manager = (SelectionManager) this.GetService(typeof(SelectionManager));
                 if (manager != null)
                 {
                     manager.BodyGlyphAdorner.Glyphs.Insert(0, this.dummyToolStripGlyph);
                 }
             }
             ToolStripKeyboardHandlingService service2 = (ToolStripKeyboardHandlingService) this.GetService(typeof(ToolStripKeyboardHandlingService));
             if (service2 != null)
             {
                 int num = this.dropDown.Items.Count - 1;
                 if (num >= 0)
                 {
                     service2.SelectedDesignerControl = this.dropDown.Items[num];
                 }
             }
         }
     }
 }
 public void ShowMenu()
 {
     if (this.menuItem != null)
     {
         Control parent    = this.designMenu.Parent;
         Form    component = parent as Form;
         if (component != null)
         {
             this.parentFormDesigner = this.host.GetDesigner(component) as FormDocumentDesigner;
             if ((this.parentFormDesigner != null) && (this.parentFormDesigner.Menu != null))
             {
                 this.parentMenu = this.parentFormDesigner.Menu;
                 this.parentFormDesigner.Menu = null;
             }
         }
         this.selected           = true;
         this.designMenu.Visible = true;
         this.designMenu.BringToFront();
         this.menuItem.Visible = true;
         if ((this.currentParent != null) && (this.currentParent != this.menuItem))
         {
             ToolStripMenuItemDesigner designer = this.host.GetDesigner(this.currentParent) as ToolStripMenuItemDesigner;
             if (designer != null)
             {
                 designer.RemoveTypeHereNode(this.currentParent);
             }
         }
         this.menuItem.DropDown           = this.dropDown;
         this.menuItem.DropDown.OwnerItem = this.menuItem;
         if (this.dropDown.Items.Count > 0)
         {
             ToolStripItem[] array = new ToolStripItem[this.dropDown.Items.Count];
             this.dropDown.Items.CopyTo(array, 0);
             foreach (ToolStripItem item in array)
             {
                 if (item is DesignerToolStripControlHost)
                 {
                     this.dropDown.Items.Remove(item);
                 }
             }
         }
         ToolStripMenuItemDesigner designer2 = (ToolStripMenuItemDesigner)this.host.GetDesigner(this.menuItem);
         BehaviorService           service   = (BehaviorService)this.GetService(typeof(BehaviorService));
         if (service != null)
         {
             if ((designer2 != null) && (parent != null))
             {
                 Rectangle parentBounds = service.ControlRectInAdornerWindow(parent);
                 if (ToolStripDesigner.IsGlyphTotallyVisible(service.ControlRectInAdornerWindow(this.designMenu), parentBounds))
                 {
                     designer2.InitializeDropDown();
                 }
             }
             if (this.dummyToolStripGlyph == null)
             {
                 Point     pos    = service.ControlToAdornerWindow(this.designMenu);
                 Rectangle bounds = this.designMenu.Bounds;
                 bounds.Offset(pos);
                 this.dummyToolStripGlyph = new ControlBodyGlyph(bounds, Cursor.Current, this.menuItem, new ContextMenuStripBehavior(this.menuItem));
                 SelectionManager manager = (SelectionManager)this.GetService(typeof(SelectionManager));
                 if (manager != null)
                 {
                     manager.BodyGlyphAdorner.Glyphs.Insert(0, this.dummyToolStripGlyph);
                 }
             }
             ToolStripKeyboardHandlingService service2 = (ToolStripKeyboardHandlingService)this.GetService(typeof(ToolStripKeyboardHandlingService));
             if (service2 != null)
             {
                 int num = this.dropDown.Items.Count - 1;
                 if (num >= 0)
                 {
                     service2.SelectedDesignerControl = this.dropDown.Items[num];
                 }
             }
         }
     }
 }