Пример #1
0
        public void Startup(StartupEventArgs startupEventArgs)
        {
            var dataProvider = new ExampleDataProvider();

            var listExampleViewModel = new ListExampleViewModel(dataProvider);
            var converterAndBehaviorExampleViewModel = new ConverterAndBehaviorExampleViewModel();
            var commandExampleViewModel = new CommandExampleViewModel();
            var mainWindowViewModel     = new MainWindowViewModel("Run-Time-Title",
                                                                  commandExampleViewModel,
                                                                  converterAndBehaviorExampleViewModel,
                                                                  listExampleViewModel);

            var mainWindow = new MainWindow
            {
                DataContext = mainWindowViewModel
            };

            mainWindow.Show();
        }
Пример #2
0
        public void Install(IPluginInfo pluginInfo)
        {
            CommandExampleViewModel commandExamleViewModel = new CommandExampleViewModel();

            _panel = new DockingPaneViewModel(commandExamleViewModel)
            {
                Header          = "Command测试示例",
                IsActive        = true,
                IsHidden        = false,
                InitialPosition = DockPosition.FloatingDockable,
                IsDocument      = true
            };
            M.DockingManager.InsertPane(_panel);

            //注册全局命令
            alertMessage      = new RelayCommand(OnAlertMessage);
            alertMessageAsync = new AsyncCommand(OnAlertMessage, CanAlertMessageAsync);
            M.CommandManager.Register(new CommandInfo("AlertMessage", alertMessage));                   //全局命令可以任何地方使用
            M.CommandManager.Register(new CommandInfo("AlertMessageAsync", alertMessageAsync.Command)); //AsyncCommand在注册全局命令是需要用其属性Command
        }