Esempio 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);
        }
Esempio 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"));
        }
Esempio 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);
        }
Esempio n. 7
0
 public override decimal Order(IMenuFactory menu)
 {
     return(menu.CreateMenu());
 }