private static void OnExecuteImagingToolsCommand(object sender, EventArgs e) { try { if (imagingToolsView == null || imagingToolsView.IsDisposed) { imagingToolsViewModel?.Dispose(); imagingToolsViewModel = ViewModelFactory.CreateDefault(); imagingToolsView = ViewFactory.CreateView(imagingToolsViewModel); } imagingToolsView.Show(); } catch (Exception ex) { imagingToolsView?.Dispose(); imagingToolsViewModel?.Dispose(); imagingToolsView = null; ShellDialogs.Error(serviceProvider, Res.ErrorMessageUnexpectedError(ex.Message)); } }