Ejemplo n.º 1
0
 private void InstallMainMenus()
 {
     if (config.MainMenus != null)
     {
         var menus = config.MainMenus(menuFactory);
         //Unlike other things specified in config, this one can't be checked when ReflectorConfiguration is constructed.
         if (menus == null)
         {
             return;               //Allows developer to deliberately not specify any menus
         }
         if (menus.Count() == 0)   //Catches accidental non-specification of menus
         {
             throw new ReflectionException("No MainMenus specified.");
         }
         foreach (IMenuImmutable menu in menus.OfType <IMenuImmutable>())
         {
             metamodel.AddMainMenu(menu);
         }
     }
 }
Ejemplo n.º 2
0
        public void Reflect()
        {
            Type[] s1          = config.MenuServices;
            Type[] s2          = config.ContributedActions;
            Type[] s3          = config.SystemServices;
            Type[] services    = s1.Union(s2).Union(s3).ToArray();
            Type[] nonServices = GetTypesToIntrospect();

            InstallSpecifications(services, true);
            InstallSpecifications(nonServices, false);
            PopulateAssociatedActions(s1.Union(s2).ToArray());

            //Menus installed once rest of metamodel has been built:
            if (config.MainMenus != null)
            {
                IMenu[] mainMenus = config.MainMenus(menuFactory);
                InstallMainMenus(mainMenus);
            }
            InstallObjectMenus();
        }