Esempio n. 1
0
File: Menu.cs Progetto: Godoy/CMS
 static MenuFactory()
 {
     defaultMenu = new MenuTemplate();
     Configuration.MenuSection menuSection = Configuration.MenuSection.GetSection();
     if (menuSection != null)
     {
         defaultMenu.ItemContainers = CreateItems(menuSection.Items, new List<IMenuItemContainer>());
     }
 }
Esempio n. 2
0
File: Menu.cs Progetto: Godoy/CMS
        public static Menu BuildMenu(ControllerContext controllerContext, string templateName, string areaName, bool initialize)
        {
            Menu menu = new Menu();

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

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

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

            return menu;
        }
Esempio n. 3
0
File: Menu.cs Progetto: Godoy/CMS
 public static void RegisterAreaMenu(string templateName, string menuFileName)
 {
     lock (menuTemplates)
     {
         Configuration.MenuSection menuSection = Configuration.MenuSection.GetSection(menuFileName);
         if (menuSection != null)
         {
             MenuTemplate areaMenu = new MenuTemplate();
             areaMenu.ItemContainers = CreateItems(menuSection.Items, new List<IMenuItemContainer>());
             menuTemplates.Add(templateName, areaMenu);
         }
     }
 }