コード例 #1
0
        private static void ProcessCommands([NotNull] WebDataService dataService, [NotNull] XElement commandsElement)
        {
            Debug.ArgumentNotNull(dataService, nameof(dataService));
            Debug.ArgumentNotNull(commandsElement, nameof(commandsElement));

            foreach (var submenuElement in commandsElement.Elements("submenu"))
            {
                var webCommandSubmenu = new WebCommandSubmenu(dataService, submenuElement);

                var submenu = submenuElement.GetElementValue("submenu");

                var commandDescriptor = new CommandManager.CommandDescriptor(webCommandSubmenu, submenu, typeof(WebCommand));

                CommandManager.Add(commandDescriptor);
            }

            foreach (var commandElement in commandsElement.Elements("command"))
            {
                var webCommand = new WebCommand(dataService, commandElement);

                var submenu = commandElement.GetElementValue("submenu");

                var commandDescriptor = new CommandManager.CommandDescriptor(webCommand, submenu, typeof(WebCommand));

                CommandManager.Add(commandDescriptor);
            }
        }
コード例 #2
0
        private string GetText([NotNull] CommandManager.CommandDescriptor commandDescriptor)
        {
            Debug.ArgumentNotNull(commandDescriptor, nameof(commandDescriptor));

            if (!string.IsNullOrEmpty(commandDescriptor.Submenu))
            {
                return(commandDescriptor.Submenu + @" | " + commandDescriptor.Command.Text);
            }

            return(commandDescriptor.Command.Text);
        }