private void AddGroupsRecursive(MenuDefinitionBase menu, StandardMenuItem menuModel) { var groups = _menuItemGroups .Where(x => x.Parent == menu) .Where(x => !_excludeMenuItemGroups.Contains(x)) .OrderBy(x => x.SortOrder) .ToList(); for (var i = 0; i < groups.Count; i++) { var group = groups[i]; var menuItems = _menuItems .Where(x => x.Group == group) .Where(x => !_excludeMenuItems.Contains(x)) .OrderBy(x => x.SortOrder); foreach (var menuItem in menuItems) { var menuItemModel = menuItem.CommandDefinition != null ? new CommandMenuItem(_commandService.GetCommand(menuItem.CommandDefinition), menuItem.CommandDefinition.Command, menuModel) : (StandardMenuItem) new TextMenuItem(menuItem); AddGroupsRecursive(menuItem, menuItemModel); menuModel.Add(menuItemModel); } if (i < groups.Count - 1 && menuItems.Any()) menuModel.Add(new MenuItemSeparator()); } }
private void AddGroupsRecursive(MenuDefinition menu, StandardMenuItem menuModel) { var groups = _menuItemGroups .Where(x => x.Parent == menu) .Where(x => !_excludeMenuItemGroups.Contains(x)) .OrderBy(x => x.SortOrder) .ToList(); for (var i = 0; i < groups.Count; i++) { var group = groups[i]; var menuItems = _menuItems .Where(x => x.Group == group) .Where(x => !_excludeMenuItems.Contains(x)) .OrderBy(x => x.SortOrder); foreach (var menuItem in menuItems) { var menuItemModel = new MenuItem(menuItem); //AddGroupsRecursive(menuItem, menuItemModel); menuModel.Add(menuItemModel); } if (i < groups.Count - 1 && menuItems.Any()) { menuModel.Add(new MenuItemSeparator()); } } }
private void AddGroupsRecursive(MenuDefinitionBase menu, StandardMenuItem menuModel) { var groups = _menuItemGroups .Where(x => x.Parent == menu) .Where(x => !_excludeMenuItemGroups.Contains(x)) .OrderBy(x => x.SortOrder) .ToList(); for (var i = 0; i < groups.Count; i++) { var group = groups[i]; var menuItems = _menuItems .Where(x => x.Group == group) .Where(x => !_excludeMenuItems.Contains(x)) .OrderBy(x => x.SortOrder); foreach (var menuItem in menuItems) { var menuItemModel = menuItem.CommandDefinition != null ? new CommandMenuItem(_commandService.GetCommand(menuItem.CommandDefinition), menuItem.CommandDefinition.Command, menuModel) : (StandardMenuItem) new TextMenuItem(menuItem); AddGroupsRecursive(menuItem, menuItemModel); menuModel.Add(menuItemModel); } if (i < groups.Count - 1 && menuItems.Any()) { menuModel.Add(new MenuItemSeparator()); } } }
public CommandMenuItem(Command command, ICommand cmd, StandardMenuItem parent) { Command = cmd; _command = command; _keyGesture = IoC.Get<ICommandKeyGestureService>().GetPrimaryKeyGesture(_command.CommandDefinition); _parent = parent; _listItems = new List<StandardMenuItem>(); }