Exemplo n.º 1
0
        public void Initialize()
        {
            var commands = _commandService.GetCommandNames()
                .Where(command => !command.Item1.Contains("Base"))
                .OrderBy(command => command.Item1)
                .Select(command => new CommandViewModel
                    {
                        Name = command.Item1,
                        Description = command.Item2,
                        Properties = _commandService.GetCommandProperties(command.Item1)
                                       .Where(prop => prop.Item1 != "Test")
                                       .Select(prop => new PropertyViewModel
                                           {
                                               Name = prop.Item1,
                                               Description = prop.Item2,
                                           })
                                       .ToList(),
                    })
                .ToList();

            var viewModel = new CommandHelpViewModel
                {
                    Commands = CollectionViewSource.GetDefaultView(commands),
                };

            viewModel.FilterCommandsCommand = new DelegateCommand<string>(filter =>
                {
                    _commandFilter = filter;
                    viewModel.Commands.Filter = FilterCommands;
                });

            _container.RegisterInstance(viewModel);

            var region = _regionManager.Regions[RegionNames.HelpContent];
            var view = _container.Resolve<CommandHelpView>();

            region.Add(view);
        }
Exemplo n.º 2
0
        public CommandHelpView(CommandHelpViewModel viewModel)
        {
            InitializeComponent();

            DataContext = viewModel;
        }