예제 #1
0
 public void AddMenuItem(MenuItemBase parent, params MenuItemBase[] displayMenuItem)
 {
     foreach (var menuItemDefinition in displayMenuItem)
     {
         if (MenuItemNameList.Contains(menuItemDefinition.Name))
         {
             throw new Exception("Menu item name duplicated");
         }
         parent.Children.Add(menuItemDefinition);
         MenuItemNameList.Add(menuItemDefinition.Name);
     }
 }
예제 #2
0
 public void AddMenu(params Menu[] menu)
 {
     foreach (var menuDefinition in menu)
     {
         if (MenuItemNameList.Contains(menuDefinition.Name))
         {
             throw new Exception("Menu item name duplicated");
         }
         Items.Add(menuDefinition);
         MenuItemNameList.Add(menuDefinition.Name);
     }
 }
예제 #3
0
 public MenuItemBase FindMenuItem(Menu menu, string name)
 {
     if (!MenuItemNameList.Contains(name))
     {
         return(null);
     }
     foreach (var child in menu.Children)
     {
         if (child.Name == name)
         {
             return(child);
         }
         return(FindRecursive(child, name));
     }
     return(null);
 }