예제 #1
0
        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());
                }
            }
        }
예제 #2
0
		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());
			}
		}
예제 #3
0
        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());
                }
            }
        }