Esempio n. 1
0
        private static void OnExecuteImagingToolsCommand(object sender, EventArgs e)
        {
            try
            {
                if (manageInstallationsView == null || manageInstallationsView.IsDisposed)
                {
                    manageInstallationsViewModel?.Dispose();
#pragma warning disable VSTHRD010 // Invoke single-threaded types on Main thread - invoked in UI thread. And ThreadHelper.ThrowIfNotOnUIThread() just emits another warning.
                    shellService.GetProperty((int)__VSSPROPID2.VSSPROPID_VisualStudioDir, out object documentsDirObj);
#pragma warning restore VSTHRD010 // Invoke single-threaded types on Main thread
                    manageInstallationsViewModel = ViewModelFactory.CreateManageInstallations(documentsDirObj?.ToString());
                    manageInstallationsView      = ViewFactory.CreateView(manageInstallationsViewModel);
                }

                manageInstallationsView.Show();
            }
            catch (Exception ex)
            {
                manageInstallationsView?.Dispose();
                manageInstallationsViewModel?.Dispose();
                manageInstallationsView = null;
                ShellDialogs.Error(serviceProvider, Res.ErrorMessageUnexpectedError(ex.Message));
            }
        }