AddRange() public méthode

public AddRange ( ToolStripItem toolStripItems ) : void
toolStripItems ToolStripItem
Résultat void
Exemple #1
0
        public void GetPluginMenuItems(System.Windows.Forms.ToolStripItemCollection menu)
        {
            ICollection <System.Windows.Forms.ToolStripItem> _items = new List <System.Windows.Forms.ToolStripItem>();

            Server.GetPluginMenuItems(_items);
            menu.AddRange(_items.ToArray <ToolStripItem>());
        }
 private void AssignPayPalMenuItems(ToolStripItemCollection dropDownItems)
 {
     dropDownItems.AddRange(new ToolStripItem[]
     {
         donateInUSDollarsToolStripMenuItem,
         donateInEuroToolStripMenuItem,
         donateInGBPToolStripMenuItem
     });
 }
        /// <summary>
        /// Sorts a ToolStripItemCollection by the Text property of each ToolStripItem.
        /// Sorting is alphanumeric and case insensitive.
        /// </summary>
        /// <param name="items">The System.Windows.Forms.ToolStripItemCollection to sort.</param>
        public static void Sort(ToolStripItemCollection items)
        {
            List <ToolStripMenuItem> itemList = new List <ToolStripMenuItem>(items.Count);

            ToolStripItem[] itemArray = new ToolStripItem[items.Count];
            items.CopyTo(itemArray, 0);

            Array.Sort <ToolStripItem>(itemArray, new ToolStripItemSorter());
            items.Clear();
            items.AddRange(itemArray);
        }
Exemple #4
0
        public ToolStrip(ToolStripItem[] items)
        {
            _items = new ToolStripItemCollection(this, items);
            _items.AddRange(items);

            BackColor   = Color.FromArgb(246, 246, 246);
            BorderColor = Color.FromArgb(204, 206, 219);
            Orientation = Forms.Orientation.Vertical;

            Owner.UpClick += Application_UpClick;
        }
 public HistoryMenu(TSItems root, string text)
 {
     this.root = root;
     root.AddRange(new TSItem[] {
         index     = new TSLabel(text),
         clearMenu = new TSMenuItem(Language.ClearHistory, null, HandleClearClick)
         {
             Enabled = false,
         },
     });
 }
Exemple #6
0
        public ToolStrip(ToolStripItem[] items)
        {
            _items = new ToolStripItemCollection(this, items);
            _items.AddRange(items);

            BackColor = Color.FromArgb(246, 246, 246);
            BorderColor = Color.FromArgb(204, 206, 219);
            Orientation = Forms.Orientation.Vertical;

            Owner.UpClick += Application_UpClick;
        }
		static void AddItemsToMenu(ToolStripItemCollection collection, List<MenuItemDescriptor> descriptors)
		{
			foreach (MenuItemDescriptor descriptor in descriptors) {
				object item = CreateMenuItemFromDescriptor(descriptor);
				if (item is ToolStripItem) {
					collection.Add((ToolStripItem)item);
					if (item is IStatusUpdate)
						((IStatusUpdate)item).UpdateStatus();
				} else {
					ISubmenuBuilder submenuBuilder = (ISubmenuBuilder)item;
					collection.AddRange(submenuBuilder.BuildSubmenu(descriptor.Codon, descriptor.Caller));
				}
			}
		}
Exemple #8
0
		public static void AddItemsToMenu(ToolStripItemCollection collection, object owner, string addInTreePath)
		{
			ArrayList buildItems = AddInTree.GetTreeNode(addInTreePath).BuildChildItems(owner);
			foreach (object item in buildItems) {
				if (item is ToolStripItem) {
					collection.Add((ToolStripItem)item);
					if (item is IStatusUpdate)
						((IStatusUpdate)item).UpdateStatus();
				} else {
					ISubmenuBuilder submenuBuilder = (ISubmenuBuilder)item;
					collection.AddRange(submenuBuilder.BuildSubmenu(null, owner));
				}
			}
		}
Exemple #9
0
		static void AddItemsToMenu(ToolStripItemCollection collection, IEnumerable<MenuItemDescriptor> descriptors)
		{
			foreach (MenuItemDescriptor descriptor in descriptors) {
				object item = CreateMenuItemFromDescriptor(descriptor);
				if (item is ToolStripItem) {
					collection.Add((ToolStripItem)item);
					if (item is IStatusUpdate)
						((IStatusUpdate)item).UpdateStatus();
				} else {
					IMenuItemBuilder submenuBuilder = (IMenuItemBuilder)item;
					collection.AddRange(submenuBuilder.BuildItems(descriptor.Codon, descriptor.Parameter).Cast<ToolStripItem>().ToArray());
				}
			}
		}
 public static void AddItemsToMenu(ToolStripItemCollection collection, object owner, string addInTreePath)
 {
     ArrayList list = AddInTree.GetTreeNode(addInTreePath).BuildChildItems(owner);
     foreach (object obj2 in list)
     {
         if (obj2 is ToolStripItem)
         {
             collection.Add((ToolStripItem) obj2);
             if (obj2 is IStatusUpdate)
             {
                 ((IStatusUpdate) obj2).UpdateStatus();
             }
         }
         else
         {
             ISubmenuBuilder builder = (ISubmenuBuilder) obj2;
             collection.AddRange(builder.BuildSubmenu(null, owner));
         }
     }
 }
Exemple #11
0
        public ClipboardApplication()
        {
            clipboardNotifier.ClipboardChanged += HandleClipboard;

            if (settings.autoCleanInterval > 0)
            {
                cleanupTimer.Interval = settings.autoCleanInterval * 1000;
            }
            cleanupTimer.Tick += HandleCleanUpClicked;

            notifyIcon.DoubleClick += HandleCleanUpClicked;

            NumericUpDown intervalItemBox = new NumericUpDown {
                Minimum = 0,
                Maximum = int.MaxValue,
                Value   = settings.autoCleanInterval,
            };

            intervalItemBox.ValueChanged += HandleIntervalChange;
            NumericUpDown historyCountBox = new NumericUpDown {
                Minimum = 0,
                Maximum = int.MaxValue,
                Value   = settings.maxHistoryObjects,
            };

            historyCountBox.ValueChanged += HandleHistoryCountChange;

            TSItems children = notifyIcon.ContextMenuStrip.Items;

            children.AddRange(new TSItem[] {
                new TSLabel(string.Format(Language.Caption, Application.ProductName, Application.ProductVersion)),

                new TSSeparator(),

                new TSLabel(Language.ExistsDataCaption),
                dataDisplay,
                imageDataDisplay,
                new TSMenuItem(Language.ClearNow, null, HandleCleanUpClicked),
                new TSMenuItem(Language.Pin, null, HandlePinClick),

                new TSSeparator(),
            });

            pinned = new HistoryMenu(children, Language.PinnedMenu);

            children.Add(new TSSeparator());

            history = new HistoryMenu(children, Language.HistoryMenu)
            {
                removeOnUse = true
            };

            children.AddRange(new TSItem[] {
                new TSSeparator(),

                new TSLabel(Language.AutoCleanAt),
                new ToolStripControlHost(intervalItemBox),
                new TSLabel(Language.EnableHistory),
                new ToolStripControlHost(historyCountBox),
                new TSMenuItem(Language.NotifyChanges, null, HandleNotifyToggle)
                {
                    Checked = settings.notifyEnabled,
                },
                new TSMenuItem(Language.RunAtStartup, null, RunAtStartupClick)
                {
                    Checked = RunAtStartup
                },

                new TSSeparator(),

                new TSMenuItem(Language.Exit, null, HandleExitClick),
            });

            HandleClipboard(false, Clipboard.GetDataObject());
            Application.ApplicationExit += HandleApplicationExit;
        }
 private void AssignHelpMenuItems(ToolStripItemCollection dropDownItems)
 {
     dropDownItems.AddRange(new ToolStripItem[] {
         displayXrmToolBoxHelpToolStripMenuItem});
 }
 private void AssignCodePlexMenuItems(ToolStripItemCollection dropDownItems)
 {
     dropDownItems.AddRange(new ToolStripItem[] {
         startADiscussionToolStripMenuItem});
 }
        /// <summary>
        /// Add the array of menu items to the system tray
        /// </summary>
        /// <param name="cms">The menu</param>
        /// <param name="parent">The root of the systray menu</param>
        public override void getSessionMenuItems(ContextMenuStrip cms, ToolStripItemCollection parent)
        {
            // Suspend the layout before modification
            cms.SuspendLayout();

            parent.Clear();

            // Setup the System tray array of menu items
            ToolStripMenuItem[] tsmiArray = new ToolStripMenuItem[getSessionController().getSessionList().Count];
            int i = 0;
            foreach (Session s in getSessionController().getSessionList())
            {
                tsmiArray[i] = new ToolStripMenuItem(s.SessionDisplayText, null, listBox1_DoubleClick);
                // Make sure the menu item is tagged with the session
                tsmiArray[i].Tag = s;
                i++;
            }

            if ( tsmiArray != null )
                parent.AddRange(tsmiArray);

            // Now resume the layout
            cms.ResumeLayout();
        }
Exemple #15
0
        public void SortItems(ToolStripItemCollection items)
        {
            if(items == null)
                throw new ArgumentNullException("items");

            ArrayList list = new ArrayList();
            foreach(object o in items)
                list.Add(o);

            list.Sort(new ToolStripCustomIComparer());

            items.Clear();
            items.AddRange((ToolStripItem[])list.ToArray(typeof(ToolStripItem)));
        }
Exemple #16
0
 private static void MoveToolStripItems(ToolStripItemCollection from, ToolStripItemCollection to)
 {
     ToolStripItem[] arr = new ToolStripItem[from.Count];
     from.CopyTo(arr, 0);
     to.AddRange(arr);
 }