private void FormTraining_Load(object sender, EventArgs e)
        {
            var menu  = new MainMenu();
            var col   = new ContextMenu.MenuItemCollection(menu);
            var vocab = new MenuItem("Słownik");

            vocab.MenuItems.Add("Wybierz", vocab_Select);
            vocab.MenuItems.Add("Zobacz", vocab_Show);
            vocab.MenuItems.Add("Dodaj słowo", vocab_AddWord);
            col.Add(vocab);
            Menu = menu;
        }
Пример #2
0
 static void AddItemsToMenu(ContextMenu.MenuItemCollection collection, List <MenuItemDescriptor> descriptors)
 {
     foreach (MenuItemDescriptor descriptor in descriptors)
     {
         object item = CreateMenuItemFromDescriptor(descriptor);
         if (item is MenuItem)
         {
             collection.Add((MenuItem)item);
             if (item is IStatusUpdate)
             {
                 ((IStatusUpdate)item).UpdateStatus();
             }
         }
         else
         {
             ISubmenuBuilder submenuBuilder = (ISubmenuBuilder)item;
             collection.AddRange(submenuBuilder.BuildSubmenu(descriptor.Codon, descriptor.Caller));
         }
     }
 }