Ejemplo n.º 1
0
        public static Menu BuildMenu(ControllerContext controllerContext, string menuName, string areaName, bool initialize)
        {
            Menu menu = new Menu();

            MenuTemplate menuTemplate = new MenuTemplate();
            if (!string.IsNullOrEmpty(menuName) && menuTemplates.ContainsKey(menuName))
            {
                menuTemplate = menuTemplates[menuName];
            }
            else
            {
                menuTemplate = defaultMenu;
            }
            menu.Name = menuName;

            menu.Items = GetItems(areaName, menuTemplate.ItemContainers, controllerContext);

            InjectMenu(menu, controllerContext);

            if (initialize)
            {
                menu.Initialize(controllerContext);
            }

            return menu;
        }
Ejemplo n.º 2
0
 private static void InjectMenu(Menu menu, ControllerContext controllerContext)
 {
     var injections = Kooboo.Common.ObjectContainer.EngineContext.Current.ResolveAll<IMenuInjection>();
     foreach (var injection in injections)
     {
         injection.Inject(menu, controllerContext);
     }
 }