private void AddContributedAction(IActionSpecImmutable ca, IObjectSpecImmutable spec)
        {
            var    facet       = ca.GetFacet <IContributedActionFacet>();
            string subMenuName = facet.SubMenuWhenContributedTo(spec);

            if (subMenuName != null)
            {
                string   id      = facet.IdWhenContributedTo(spec);
                MenuImpl subMenu = GetSubMenuIfExists(subMenuName) ?? CreateMenuImmutableAsSubMenu(subMenuName, id);
                subMenu.AddOrderableElementsToMenu(new List <IActionSpecImmutable> {
                    ca
                }, subMenu);
            }
            else
            {
                //i.e. no sub-menu
                AddMenuItem(new MenuAction(ca));
            }
        }
Exemplo n.º 2
0
        public ITypedMenu <TObject> AddContributedActions()
        {
            IObjectSpecImmutable spec = GetObjectSpec <TObject>();

            foreach (IActionSpecImmutable ca in spec.ContributedActions)
            {
                var    facet       = ca.GetFacet <IContributedActionFacet>();
                string subMenuName = facet.SubMenuWhenContributedTo(spec);
                if (subMenuName != null)
                {
                    string   id      = facet.IdWhenContributedTo(spec);
                    MenuImpl subMenu = GetSubMenuIfExists(subMenuName) ?? CreateMenuImmutableAsSubMenu(subMenuName, id);
                    subMenu.AddOrderableElementsToMenu(new List <IActionSpecImmutable> {
                        ca
                    }, subMenu);
                }
                else
                {
                    //i.e. no sub-menu
                    AddMenuItem(new MenuAction(ca));
                }
            }
            return(this);
        }