protected override void OnOpening(CancelEventArgs e)
 {
     base.Groups["StandardList"].Items.Clear();
     base.Groups["CustomList"].Items.Clear();
     base.Populated = false;
     foreach (ToolStripItem item in ToolStripDesignerUtils.GetStandardItemMenuItems(this.component, this.onClick, this.convertTo))
     {
         base.Groups["StandardList"].Items.Add(item);
         if (this.convertTo)
         {
             ItemTypeToolStripMenuItem item2 = item as ItemTypeToolStripMenuItem;
             if (((item2 != null) && (this.currentItem != null)) && (item2.ItemType == this.currentItem.GetType()))
             {
                 item2.Enabled = false;
             }
         }
     }
     foreach (ToolStripItem item3 in ToolStripDesignerUtils.GetCustomItemMenuItems(this.component, this.onClick, this.convertTo, this.serviceProvider))
     {
         base.Groups["CustomList"].Items.Add(item3);
         if (this.convertTo)
         {
             ItemTypeToolStripMenuItem item4 = item3 as ItemTypeToolStripMenuItem;
             if (((item4 != null) && (this.currentItem != null)) && (item4.ItemType == this.currentItem.GetType()))
             {
                 item4.Enabled = false;
             }
         }
     }
     base.OnOpening(e);
 }
예제 #2
0
        protected override void OnOpening(CancelEventArgs e)
        {
            Groups["StandardList"].Items.Clear();
            Groups["CustomList"].Items.Clear();
            Populated = false;

            // plumb through the standard and custom items.
            foreach (ToolStripItem item in ToolStripDesignerUtils.GetStandardItemMenuItems(_component, _onClick, _convertTo))
            {
                Groups["StandardList"].Items.Add(item);
                if (_convertTo)
                {
                    if (item is ItemTypeToolStripMenuItem toolItem && _currentItem != null && toolItem.ItemType == _currentItem.GetType())
                    {
                        toolItem.Enabled = false;
                    }
                }
            }

            foreach (ToolStripItem item in ToolStripDesignerUtils.GetCustomItemMenuItems(_component, _onClick, _convertTo, _serviceProvider))
            {
                Groups["CustomList"].Items.Add(item);
                if (_convertTo)
                {
                    if (item is ItemTypeToolStripMenuItem toolItem && _currentItem != null && toolItem.ItemType == _currentItem.GetType())
                    {
                        toolItem.Enabled = false;
                    }
                }
            }

            base.OnOpening(e);
        }