Example #1
0
        private void CreateQuickLaunchItems(List<QuickLaunchItem> quickLaunchItems, MenuItemViewModel menuItem, string prefix)
        {
            Debug.Assert(quickLaunchItems != null);
            Debug.Assert(prefix != null);

            if (menuItem == null)
                return;

            var commandItem = menuItem.CommandItem as CommandItem;
            if (commandItem != null && !string.IsNullOrEmpty(commandItem.Text) && commandItem.Command != null)
            {
                quickLaunchItems.Add(new QuickLaunchItem
                {
                    Icon = commandItem.Icon,
                    Title = $"{prefix}{EditorHelper.FilterAccessKeys(commandItem.Text)}",
                    KeyGesture = GetKeyGesture(commandItem),
                    Description = commandItem.ToolTip,
                    Command = commandItem.Command,
                    CommandParameter = commandItem.CommandParameter,
                    Tag = this
                });
            }

            if (menuItem.Submenu != null && menuItem.Submenu.Count > 0)
            {
                if (!string.IsNullOrEmpty(menuItem.CommandItem.Text))
                    prefix = $"{prefix}{EditorHelper.FilterAccessKeys(menuItem.CommandItem.Text)} → ";

                foreach (var subMenuItem in menuItem.Submenu)
                    CreateQuickLaunchItems(quickLaunchItems, subMenuItem, prefix);
            }
        }
Example #2
0
        private void ConfigureStatusMenu()
        {
            var vm = new StatusMenuViewModel();

            var menu = new MenuItemViewModel() { Header = Messages.Menu_Status };
            menu.Children.Add(new MenuItemViewModel { Header = Messages.Menu_RandomStatus, Command = vm.RandomStatusCommand });
            menu.Children.Add(new MenuItemViewModel { Header = Messages.Menu_ReadyStatus, Command = vm.StatusReadyCommand });
            MenuService.Menu.Add(menu);
        }
Example #3
0
 public MenuItemController(ApplicationDbContext db, IWebHostEnvironment webHostEnvironment)
 {
     _db = db;
     _webHostEnvironment = webHostEnvironment;
     MenuItemViewModel   = new MenuItemViewModel
     {
         Categories    = _db.Category,
         SubCategories = _db.SubCategory,
         MenuItem      = new Models.MenuItem()
     };
 }
Example #4
0
        }                                                 // It works like a global object and no need to pass as parameters

        public MenuItemController(ApplicationDbContext db, IWebHostEnvironment webHostEnvironment)
        {
            _db = db;
            _webhostEnvironment = webHostEnvironment;
            MenuItemVM          = new MenuItemViewModel()
            {
                Category = _db.Category,
                MenuItem = new Models.MenuItem()
                           //Not setting subcategory as its dependsup on need to populate by the categories
            };
        }
Example #5
0
        private MenuItemViewModel GetLaunchOnStartup()
        {
            MenuItemViewModel vm = GetViewModel("Menu.LaunchOnStartup", x => _startupHelper.ReverseState());

            vm.IsCheckable      = true;
            vm.CommandParameter = vm;
            vm.IsChecked        = _startupHelper.IsInStartup();
            // TODO add weak event handler
            _startupHelper.StateChanged += (appName, state) => vm.IsChecked = (state == AutoStartupState.On);
            return(vm);
        }
Example #6
0
 /// <summary>
 ///		Crea una opción de menú o un separador
 /// </summary>
 private Control CreateMenu(MenuItemViewModel menu)
 {
     if (menu.IsSeparator)
     {
         return(new Separator());
     }
     else
     {
         return(CreateMenu(menu.Text, menu.Icon, menu.Command, menu));
     }
 }
Example #7
0
 public MenuItemController(ApplicationDbContext db, IWebHostEnvironment webHostEnvironment)
 {
     _db = db;
     _webHostEnvironment = webHostEnvironment;
     MenuItemViewModel   = new MenuItemViewModel
     {
         MenuItem     = new Models.MenuItem(),
         CategoryList = _db.Category,
         //SubCategoryList = await _db.SubCategory.ToListAsync()
     };
 }
Example #8
0
        public ActionResult EditMenuItem(int restaurantId, int menuId)
        {
            var menuItem = _restaurantManagement.GetMenus().
                           FirstOrDefault(t => t.Id == restaurantId)
                           .Items.FirstOrDefault(t => t.Id == menuId);
            var menu = MenuItemViewModel.Map(menuItem);

            ViewBag.RestaurantId = restaurantId;

            return(PartialView("_EditMenuItem", menu));
        }
Example #9
0
        public IActionResult OnGet()
        {
            this.menuItemViewModel = new MenuItemViewModel()
            {
                categoryTypes = _dbContext.CategoryTypes.ToList(),
                foodTypes     = _dbContext.FoodTypes.ToList(),
                menuItem      = new MenuItem()
            };

            return(Page());
        }
Example #10
0
 //---Dependency Injection
 public MenuItemController(ApplicationDbContext db, IWebHostEnvironment hostingEnvironment)
 {
     _db = db;
     _hostingEnvironment = hostingEnvironment;
     //---Init object with bind prop and then use it in create method
     MenuItemVM = new MenuItemViewModel()
     {
         Category = _db.Category,
         MenuItem = new Models.MenuItem()
     };
 }
Example #11
0
        public MenuItemController(ApplicationDbContext db, IWebHostEnvironment hostingEnvironment)
        {
            _db = db;
            _hostingEnvironment = hostingEnvironment;

            MenuItemVM = new MenuItemViewModel()
            {
                Category = _db.Category,
                MenuItem = new Models.MenuItem()
            };
        }
Example #12
0
        // ------------
        // --- Menu ---
        // ------------
        #region Menu
        public ActionResult ManagementMenu(int?page, string searchString, string currentFilter)
        {
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            ViewBag.CurrentFilter = searchString;

            IEnumerable <MenuModel> menuModels = _menuManager.GetAll();
            var menus = new List <MenuViewModel>();

            foreach (var item in menuModels)
            {
                var menuViewModel = new MenuViewModel {
                    Id        = item.Id,
                    TitleMenu = item.TitleMenu,
                    Code      = item.Code,
                };

                if (item.MenuItemsModel != null)
                {
                    var listMenuItem = new List <MenuItemViewModel>();
                    foreach (var menuItem in item.MenuItemsModel)
                    {
                        var newMenuitem = new MenuItemViewModel {
                            Id            = menuItem.Id,
                            MenuID        = menuItem.MenuID,
                            PageID        = menuItem.PageID,
                            TitleMenuItem = menuItem.TitleMenuItem,
                            Url           = menuItem.Url,
                            Weight        = menuItem.Weight
                        };
                        listMenuItem.Add(newMenuitem);
                    }
                    menuViewModel.MenuItems = listMenuItem;
                }

                menus.Add(menuViewModel);
            }
            menus.Reverse();

            if (!String.IsNullOrEmpty(searchString))
            {
                menus = menus.Where(m => m.TitleMenu.ToUpper().Contains(searchString.ToUpper()) || m.Code.ToUpper().Contains(searchString.ToUpper())).ToList();
            }

            int pageNumber = (page ?? 1);

            return(View(menus.ToPagedList(pageNumber, PAGE_SIZE)));
        }
Example #13
0
        public IActionResult OnGet()
        {
            MenuItemVM = new MenuItemViewModel
            {
                MenuItem     = new MenuItem(),
                FoodType     = _db.FoodType.ToList(),
                CategoryType = _db.CategoryType.ToList()
            };

            return(Page());
        }
Example #14
0
        public MenuItemViewModel AddMenuEntry(MenuID menuID)
        {
            MenuItemViewModel menuItem = new MenuItemViewModel()
            {
                ID     = (int)menuID,
                Header = menuID.ToString(),
            };

            Menu.AddOrUpdate(menuItem);
            return(menuItem);
        }
Example #15
0
 public MenuItemController(ApplicationDbContext context, IWebHostEnvironment enviroment)
 {
     _context           = context;
     _hostingEnviroment = enviroment;
     MenuItemViewModel  = new MenuItemViewModel()
     {
         Categories = _context.Categories,
         MenuItem   = new MenuItem()
     };
     MenuItems = _context.MenuItems;
 }
 public MenuItemController(ApplicationDbContext context, IHostingEnvironment hostingEnvironment)
 {
     this.context            = context;
     this.hostingEnvironment = hostingEnvironment;
     MenuItemViewModel       = new MenuItemViewModel()
     {
         MenuItem   = new Models.MenuItem(),
         Categories = context.Categories
                      //SubCategories = context.SubCategories,//This depends on which subcategories is selected
     };
 }
Example #17
0
 public MenuItemController(ApplicationDbContext db, IHostingEnvironment hostingEnvironment)
 {
     _db = db;
     _hostingEnvironment = hostingEnvironment;
     //video 106 should watch
     MenuItemVM = new MenuItemViewModel()
     {
         Category = _db.Category,
         MenuItem = new Models.MenuItem()
     };
 }
        public ActionResult AddMenuItem()
        {
            MenuItemViewModel model = new MenuItemViewModel();

            using (ApplicationDbContext db = new ApplicationDbContext())
            {
                model.Categories = new SelectList(db.Categories.ToList(), "CategoryId", "Name");
            }

            return(View(model));
        }
Example #19
0
 public MenuItemController(ApplicationDbContext db, IWebHostEnvironment hostEnvironment)
 {
     _db = db;
     _hostingEnvironment = hostEnvironment;
     MenuItemVM          = new MenuItemViewModel
     {
         CategoryList = _db.Category,
         //SubCategoryList = _db.SubCategory,
         MenuItem = new Models.MenuItem() //A subcategory?
     };
 }
 public void ShowMenuItem(MenuItemViewModel item, Dictionary <string, string> args = null)
 {
     if (args != null)
     {
         ShowViewModel(item.Target, new MvxBundle(args));
     }
     else
     {
         ShowViewModel(item.Target);
     }
 }
Example #21
0
        }                                                //used on any post request

        public MenuItemsController(ApplicationDbContext db, IHostingEnvironment hostingEnvironment)
        {
            _db = db;

            _hostingEnvironment = hostingEnvironment;

            MenuItemVM = new MenuItemViewModel()
            {
                Category = _db.Category.ToList(),
                MenuItem = new MenuItem()
            };
        }
Example #22
0
 public MenuItemController(ApplicationDbContext db, IWebHostEnvironment hostEnv)
 {
     _db = db;
     _hostingEnvironment = hostEnv;
     MenuItemVM          = new MenuItemViewModel()
     {
         //I will need only the list of categories because the list of subCategories
         // will depend on selected category
         Category = _db.Category,
         MenuItem = new Models.MenuItem()
     };
 }
Example #23
0
        public async Task <IActionResult> EditMenuItem(int?id, MenuItemViewModel MenuVM)
        {
            if (id == null)
            {
                return(NotFound());
            }
            MenuVM.MenuItem.SubCatagorId = Convert.ToInt32(Request.Form["SubCatagoryId"].ToString());
            if (ModelState.IsValid)
            {
                //New ImageSaving Section
                string webRootPath  = env.WebRootPath;
                var    menuItemInDb = await db.MenuItems.FindAsync(MenuVM.MenuItem.Id);

                if (MenuVM.Thumbnail != null)
                {
                    var uploadPath = Path.Combine(webRootPath, SD.ImageFolder);
                    var fileExt    = Path.GetExtension(MenuVM.Thumbnail.FileName);
                    var fileName   = Guid.NewGuid().ToString() + "." + fileExt;
                    var finalPath  = Path.Combine(uploadPath, fileName);



                    //Delete the original file
                    var imagePath = Path.Combine(webRootPath, menuItemInDb.Image.TrimStart('\\'));
                    if (System.IO.File.Exists(imagePath))
                    {
                        System.IO.File.Delete(imagePath);
                    }
                    using (var stream = new FileStream(finalPath, FileMode.Create))
                    {
                        await MenuVM.Thumbnail.CopyToAsync(stream);
                    }
                    menuItemInDb.Image = @"\images\" + fileName;
                }

                mapper.Map <MenuItem>(MenuVM.MenuItem);
                //menuItemInDb.Name = MenuVM.MenuItem.Name;
                //menuItemInDb.Price = MenuVM.MenuItem.Price;
                //menuItemInDb.CatagorId = MenuVM.MenuItem.CatagorId;
                //menuItemInDb.SubCatagorId = MenuVM.MenuItem.SubCatagorId;
                //menuItemInDb.Spicyness = MenuVM.MenuItem.Spicyness;
                //menuItemInDb.Description = MenuVM.MenuItem.Description;
                //menuItemInDb.IsFeatured = MenuVM.MenuItem.IsFeatured;
                await db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            MenuVM.Catagories = await db.Catagories.ToListAsync();

            MenuVM.SubCatagories = await db.SubCatagories.ToListAsync();

            return(View(MenuVM));
        }
 public void AddMenuItem(MenuItemViewModel menuItem)
 {
     _db.MenuItems.Add(new MenuItem {
         Name        = menuItem.Name,
         Description = menuItem.Description,
         Price       = (double)menuItem.Price,
         SpicyLevel  = (int)menuItem.SpicyLevel,
         isDeleted   = false
     }
                       );
     _db.SaveChanges();
 }
Example #25
0
        public List <MenuItemViewModel> GetAllMenuItemViewModels()
        {
            List <MenuItemViewModel> menuItemVMs = new List <MenuItemViewModel>();
            var menuItems = this.GetAllMenuItems();

            foreach (var menuItem in menuItems)
            {
                MenuItemViewModel VM = new MenuItemViewModel
                {
                    Id               = menuItem.Id,
                    Title            = menuItem.Title,
                    ShortDescription = menuItem.ShortDescription,
                    LongDescription  = menuItem.LongDescription,
                    ImageUrl         = menuItem.ImageUrl,
                    ThumbnailUrl     = menuItem.ThumbnailUrl,
                    Type             = menuItem.Type,
                    Sizes            = new List <Size>(),
                    Crusts           = new List <Crust>(),
                    Cuts             = new List <Cut>(),
                    Sauces           = new List <Sauce>(),
                    Toppings         = new List <ToppingVm>()
                };
                foreach (var mit in menuItem.MenuItemToppings)
                {
                    ToppingVm tvm = new ToppingVm
                    {
                        topping    = mit.Topping,
                        isSelected = true
                    };
                    VM.Toppings.Add(tvm);
                }
                foreach (var mis in menuItem.MenuItemSauces)
                {
                    VM.Sauces.Add(mis.Sauce);
                }
                foreach (var mic in menuItem.MenuItemCrusts)
                {
                    VM.Crusts.Add(mic.Crust);
                }
                foreach (var mic in menuItem.MenuItemCuts)
                {
                    VM.Cuts.Add(mic.Cut);
                }
                foreach (Size size in menuItem.Sizes)
                {
                    VM.Sizes.Add(size);
                }

                menuItemVMs.Add(VM);
            }

            return(menuItemVMs);
        }
Example #26
0
        private MenuDesignViewModel()
        {
            var item = new MenuItemViewModel
            {
                Type = MenuItemType.Header,
                Icon = IconType.None,
                Text = "Design Time Header..."
            };

            MenuItems.Add(item);
            GenerateItems();
        }
Example #27
0
 public async Task Navigate(MenuItemViewModel viewModel)
 {
     _masterPage.IsPresented = false;
     if (viewModel.PageName == "Logout")
     {
         Logout();
     }
     else
     {
         await _navigationPage.PushAsync(viewModel.Page);
     }
 }
Example #28
0
        /// <summary>
        /// Modify the context menu view model by adding custom menu items.
        /// </summary>
        /// <param name="contextMenu">Context menu view model containing automatically added menu items.</param>
        /// <param name="element">Host element.</param>
        /// <param name="processedProviders">Providers that have already been visited.</param>
        public virtual void ProcessContextMenu(MenuItemViewModel contextMenu, ModelElementTreeViewModel element, List <IModelTreeContextMenuProvider> processedProviders)
        {
            processedProviders.Add(this);

            foreach (IModelTreeContextMenuProvider p in this.InjectedContextMenuProviders)
            {
                if (!processedProviders.Contains(p))
                {
                    p.ProcessContextMenu(contextMenu, element, processedProviders);
                }
            }
        }
Example #29
0
        public IActionResult Create(int?restaurantId)
        {
            if (restaurantId == null)
            {
                return(NotFound());
            }
            var vm = new MenuItemViewModel();

            vm.Restaurant = _repo.restaurants.Get((int)restaurantId);
            LoadCategorySelectList();
            return(View(vm));
        }
Example #30
0
 public void ShowMenuItem(MenuItemViewModel item, Dictionary <string, string> args = null)
 {
     Debug.WriteLine("REDICTERING ShowMenuItem");
     if (args != null)
     {
         ShowViewModel(item.Target, new MvxBundle(args));
     }
     else
     {
         ShowViewModel(item.Target);
     }
 }
        public MenuItemController(ApplicationDbContext db, IWebHostEnvironment hostingEnvironment, IUnitOfWork unitOfWork)
        {
            _db = db;
            _hostingEnvironment = hostingEnvironment;
            _unitOfWork         = unitOfWork;

            MenuItemVM = new MenuItemViewModel()
            {
                Category  = _unitOfWork.Category.GetAllList(),
                MenuItems = new MenuItems()
            };
        }
Example #32
0
        public ActionResult Edit(int?id, int?selectedMenuTypeID, string itemtype = "")
        {
            if (id == null)
            {
                return(BadRequest());
            }
            Menu menu = db.Menus.Include(x => x.Access).Include(x => x.Parent).Include(x => x.MenuType)
                        .SingleOrDefault(x => x.ID == id);

            if (menu == null)
            {
                return(HttpNotFound());
            }

            MenuItemViewModel model = new MenuItemViewModel();

            model.ItemType         = string.IsNullOrEmpty(itemtype) ? menu.Type : itemtype;
            model.AllMenuTypes     = db.MenuTypes.ToList();
            model.TheMenu          = menu;
            model.selectedAccessID = menu.Access == null ? 0 : menu.Access.ID;
            model.selectedParentID = menu.Parent == null ? null : (int?)menu.Parent.ID;
            model.TheMenuType      = menu.MenuType;

            model.selectedContentID  = menu.ContentID;
            model.selectedCategoryID = menu.CategoryID;

            model.AlllCategories = GetAllCategories();
            model.AllContents    = GetAllContents();
            model.AllViewLevels  = GetAllViewLevels();
            model.AllLanguages   = db.GetAllLanguages();

            if (selectedMenuTypeID != null && model.TheMenuType != null && model.TheMenuType.ID != selectedMenuTypeID)
            {
                model.selectedMenuTypeID = selectedMenuTypeID;
                model.TheMenuType        = db.MenuTypes.SingleOrDefault(x => x.ID == selectedMenuTypeID);
            }

            if (model.TheMenuType != null)
            {
                model.AllMenus = db.GetAllMenuItems(
                    db.Menus.Where(x => x.MenuType != null && x.MenuType.ID == model.TheMenuType.ID).ToList(),
                    (int)id);
                model.selectedMenuTypeID = model.TheMenuType.ID;
            }
            else
            {
                model.selectedMenuTypeID = null;
                model.AllMenus           = db.GetAllMenuItems(null, (int)id);
            }

            return(View(model));
        }
Example #33
0
        private void ConfigureLogMenu()
        {
            var vm = new DebugMenuViewModel();

            var menu = new MenuItemViewModel() { Header = Messages.Menu_Debug };
            menu.Children.Add(new MenuItemViewModel { Header = Messages.Menu_RandomLog, Command = vm.RandomLogCommand });
            menu.Children.Add(new MenuItemViewModel { Header = Messages.Menu_LogAll, Command = vm.LogAllLevelCommand });
            menu.Children.Add(new MenuItemViewModel(isSeparator: true));
            menu.Children.Add(new MenuItemViewModel { Header = Messages.Menu_ClearLog, Command = vm.ClearLogsCommand });
            menu.Children.Add(new MenuItemViewModel(isSeparator: true));
            menu.Children.Add(new MenuItemViewModel { Header = Messages.Menu_GoToDebug, Command = vm.ClearLogsCommand });
            MenuService.Menu.Add(menu);
        }
        private MenuItemViewModel CurrentlyCheckedExcept(MenuItemViewModel current)
        {
            foreach (var abstractCommandable in Children)
            {
                var mi = abstractCommandable as MenuItemViewModel;
                if (mi != null && mi != current && mi.IsChecked == true)
                {
                    return mi;
                }
            }

            return null;
        }
        public ReceiveDataViewModel(Shared.Model.Server server)
        {
            this._server = server;
            this.GroupItemsCommand = new RelayCommand<object>(this.OnGroupItems);

            this.Suggestions = new ObservableCollection<SuggestionItemGroup>();
            this.StartServerCommand = new RelayCommand(this.StartServer);

            this.MenuItems.Insert(0, new MenuItemViewModel("Auswertung")
            {
                SubItems =
                {
                    new MenuItemViewModel("Drucken")
                    {
                        Command =new RelayCommand(this.OnPrintAnalysis),
                    },
                    //new MenuItemViewModel("Daten an Clients senden")
                    //{
                    //    Command =new RelayCommand(this.OnSendAnalysisToClients),
                    //},
                },
            });
            this.MenuItems.Insert(0, new MenuItemViewModel("Server")
            {
                SubItems =
                {
                    (this._stopServer = new MenuItemViewModel("Server anhalten")
                    {
                        IsCheckable=true,
                        Command = new RelayCommand(this.OnStopServer),
                    }),
                },
            });
            this.MenuItems.Insert(0, new MenuItemViewModel("Datei")
            {
                SubItems =
                {
                    new MenuItemViewModel("Daten Exportieren")
                    {
                        Command =new RelayCommand(this.OnExportData),
                    },
                    new MenuItemViewModel("Daten Importieren")
                    {
                        Command =new RelayCommand(this.OnImportData),
                    },
                },
            });
        }
Example #36
0
        //--------------------------------------------------------------
        /// <inheritdoc/>
        public MenuItemViewModel CreateMenuItem()
        {
            if (_menuItem == null)
            {
                _menuItem = new MenuItemViewModel(this) { Submenu = new MenuItemViewModelCollection() };
                UpdateMenu();
            }

            return _menuItem;
        }
Example #37
0
        //--------------------------------------------------------------
        /// <inheritdoc/>
        public MenuItemViewModel CreateMenuItem()
        {
            if (_menuItemViewModel == null)
            {
                _menuItemViewModel = new MenuItemViewModel(this) { Submenu = new MenuItemViewModelCollection() };

                var changeHighlightingCommand = new DelegateCommand<IHighlightingDefinition>(ChangeHighlighting, CanChangeHighlighting);

                _menuItemViewModel.Submenu.Add(
                    new MenuItemViewModel(
                        new DelegateCommandItem("None", changeHighlightingCommand)
                        {
                            Category = Category,
                            CommandParameter = null,
                            IsCheckable = true,
                            IsChecked = false,
                            Text = "None"
                        }));

                var highlightingDefinitions = _highlightingService.HighlightingDefinitions.OrderBy(def => def.Name);
                foreach (var syntaxHighlighting in highlightingDefinitions)
                {
                    _menuItemViewModel.Submenu.Add(
                        new MenuItemViewModel(
                            new DelegateCommandItem(syntaxHighlighting.Name, changeHighlightingCommand)
                            {
                                Category = Category,
                                CommandParameter = syntaxHighlighting,
                                IsCheckable = true,
                                IsChecked = false,
                                Text = syntaxHighlighting.Name,
                            }));
                }

                Update();
            }

            return _menuItemViewModel;
        }
Example #38
0
        //--------------------------------------------------------------
        /// <inheritdoc/>
        public MenuItemViewModel CreateMenuItem()
        {
            if (_menuItem == null)
            {
                _menuItem = new MenuItemViewModel(this) { Submenu = new MenuItemViewModelCollection() };

                // Add a sub-menu item for each document type.
                var documentTypes = _documentExtension.GetCreatableDocumentTypes()
                                                      .OrderBy(documentType => documentType.Name);

                foreach (var documentType in documentTypes)
                {
                    _menuItem.Submenu.Add(
                        new MenuItemViewModel(
                            new DelegateCommandItem($"New {documentType.Name}", (IDelegateCommand)Command)
                            {
                                Category = Category,
                                CommandParameter = documentType,
                                Icon = documentType.Icon,
                                Text = documentType.Name,
                                ToolTip = ToolTip
                            }));
                }
            }

            return _menuItem;
        }
Example #39
0
        //--------------------------------------------------------------
        #region Methods
        //--------------------------------------------------------------

        /// <inheritdoc/>
        public MenuItemViewModel CreateMenuItem()
        {
            if (_menuItemViewModel == null)
            {
                _menuItemViewModel = new MenuItemViewModel(this) { Submenu = new MenuItemViewModelCollection() };

                var changeThemeCommand = new DelegateCommand<string>(ChangeTheme);

                foreach (var theme in _themeExtension.Themes)
                {
                    _menuItemViewModel.Submenu.Add(
                        new MenuItemViewModel(
                            new DelegateCommandItem("ChangeThemeTo" + theme, changeThemeCommand)
                            {
                                Category = Category,
                                CommandParameter = theme,
                                IsCheckable = true,
                                IsChecked = _themeExtension.Theme == theme,
                                Text = theme,
                                ToolTip = Invariant($"Change user interface theme to '{theme}'"),
                            }));
                }
            }

            return _menuItemViewModel;
        }
Example #40
0
 private void Detail(MenuItemViewModel menuItem)
 {
     _detailService.DetailTo(menuItem.ID);
 }
Example #41
0
        //--------------------------------------------------------------
        #region Methods
        //--------------------------------------------------------------

        public MenuItemViewModel CreateMenuItem()
        {
            if (_menuItemViewModel == null)
            {
                // Use the same collection for the submenu and the toolbars context menu!
                _menuItemViewModel = new MenuItemViewModel(this)
                {
                    Submenu = _commandExtension.Editor.ToolBarContextMenu
                };

                _menuSeparatorViewModel = new MenuSeparatorViewModel(new CommandSeparator("ToolBarsSeparator"));
                _menuItemViewModel.Submenu.Add(_menuSeparatorViewModel);
                _menuItemViewModel.Submenu.Add(_commandExtension.CommandItems["ShowAllToolBars"].CreateMenuItem());
                _menuItemViewModel.Submenu.Add(_commandExtension.CommandItems["HideAllToolBars"].CreateMenuItem());
            }
            
            return _menuItemViewModel;
        }