Exemplo n.º 1
0
        private void OnMenuItemChooseItems(object sender, EventArgs e)
        {
            ChooseToolboxItemsDialog cti = new ChooseToolboxItemsDialog();

            if (cti.ShowDialog() == DialogResult.OK)
            {
                if (cti.SelectedTypes != null)
                {
                    foreach (Type type in cti.SelectedTypes)
                    {
                        Tab owner = null;
                        if (this.LastSelectedTool != null && this.LastSelectedTool is Item)
                        {
                            owner = ((Item)this.LastSelectedTool).Owner as Tab;
                        }
                        else
                        {
                            owner = this.LastSelectedTool as Tab;
                        }
                        if (owner != null)
                        {
                            this.AddToolboxItem(type, owner.Text);
                        }
                        else
                        {
                            this.AddToolboxItem(type, this.GeneralCategory.Text);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void OnMenuItemChooseItems(object sender, EventArgs e)
 {
     ChooseToolboxItemsDialog cti = new ChooseToolboxItemsDialog();
     if (cti.ShowDialog() == DialogResult.OK) {
         if (cti.SelectedTypes != null) {
             foreach (Type type in cti.SelectedTypes) {
                 Tab owner = null;
                 if (this.LastSelectedTool != null && this.LastSelectedTool is Item) {
                     owner = ((Item) this.LastSelectedTool).Owner as Tab;
                 } else {
                     owner = this.LastSelectedTool as Tab;
                 }
                 if (owner != null) {
                     this.AddToolboxItem(type, owner.Text);
                 } else {
                     this.AddToolboxItem(type, this.GeneralCategory.Text);
                 }
             }
         }
     }
 }