示例#1
0
        /// <inheritdoc />
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            try
            {
                if (_mainView == null)
                {
                    _mainView = new MainView();
                    var viewModel = new MainViewModel(commandData.Application, _mainView);
                    _mainView.DataContext = viewModel;
                    _mainView.Closed     += (sender, args) => _mainView = null;
                    _mainView.ShowDialog();

                    return(Result.Succeeded);
                }

                _mainView.Activate();
                _mainView.Focus();
                return(Result.Succeeded);
            }
            catch (Exception exception)
            {
                ExceptionBox.Show(exception);
                return(Result.Failed);
            }
        }
示例#2
0
        private void ShowStatusView()
        {
            if (_mainView == null)
            {
                _mainView             = new MainView();
                _mainView.DataContext = _mainViewVm;

                _mainView.Closing += (arg1, arg2) => _mainView = null;
                _mainView.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                _mainView.Show();
                UpdateStatusView();
            }
            else
            {
                _mainView.Activate();
            }

            _mainView.Icon = AppIcon;
        }