Exemplo n.º 1
0
        public IMenu Execute(params string[] args)
        {
            string commandName = this.GetType().Name;
            string menuName    = commandName.Substring(0, commandName.Length - "Command".Length);
            var    menu        = menuFactory.CreateMenu(menuName);

            return(menu);
        }
        public IEnumerable <IMenuItemViewModel> CreateMenuItems(object context)
        {
            var items = _menuFactory.CreateMenu(ImportMenuItemProvider.ID, context);

            yield return(new MenuItemViewModel {
                Header = "Import", Items = items, Order = 2
            });
        }
        public IEnumerable <IMenuItemViewModel> CreateMenuItems(object context)
        {
            // Create the items of the custom actions menu by using the IMenuFactory interface.
            // This will call the IMenuItemProvider implementations registered for the custom menu ID.
            var items = _menuFactory.CreateMenu(CustomMenuItemProvider.ID, context);

            yield return(new MenuItemViewModel {
                Header = "Custom actions", Items = items
            });
        }
        public IMenu Execute(params string[] args)
        {
            var categoryId  = int.Parse(args[0]);
            var commandName = this.GetType().Name;
            var menuName    = commandName.Substring(0, commandName.Length - "Command".Length);
            var menu        = (IIdHoldingMenu)menuFactory.CreateMenu(menuName);

            menu.SetId(categoryId);
            return(menu);
        }
Exemplo n.º 5
0
        public IMenu Execute(params string[] args)
        {
            string username = args[0];
            string password = args[1];

            bool success = userService.TryLogInUser(username, password);

            if (!success)
            {
                throw new InvalidOperationException("Invalid Login!");
            }

            return(menuFctory.CreateMenu("MainMenu"));
        }
Exemplo n.º 6
0
        public IMenu Execute(params string[] args)
        {
            string commandName = this.GetType().Name;
            string menuName    = commandName.Substring(0, commandName.Length - "Command".Length) + "Menu";

            IMenu menu = menuFactory.CreateMenu(menuName);

            if (menu is IIdHoldingMenu idHoldingMenu)
            {
                int postId = int.Parse(args[0]);

                idHoldingMenu.SetId(postId);
            }

            return(menu);
        }
Exemplo n.º 7
0
 public override decimal Order(IMenuFactory menu)
 {
     return(menu.CreateMenu());
 }