public static void ExecuteWithinExceptionHandler(this IUICommand uiCommand, IEventPublisher eventPublisher, IChangePropagator changePropagator) { try { eventPublisher.PublishEvent(new HeavyWorkStartedEvent()); changePropagator.SaveChanges(); uiCommand.Execute(); } catch (Exception e) { IoC.Resolve <IExceptionManager>().LogException(e); } finally { eventPublisher.PublishEvent(new HeavyWorkFinishedEvent()); } }
public override void Select() { _command.Execute(); }
private void RunSynchronousCommand(IUICommand command, RunSynchronousCommandFinished finished) { try { CommandExecutionResult result = command.Execute(); if (result.Error == null) { toolStripStatusLabel.Text = string.Format(Resources.ToolStripStatusLabelExecutionOk, result.Command.CommandName); if (result.NewProjectFile != null) { ProjectFile = result.NewProjectFile; } if (!string.IsNullOrEmpty(result.Message)) { textBoxOutput.AppendText(result.Message); } } else { textBoxOutput.Clear(); textBoxOutput.AppendText(result.Error.ToString()); toolStripStatusLabel.Text = string.Format(Resources.ToolStripStatusLabelExecutionKo, result.Command.CommandName); } ScrollHelper.ScrollToBottomLeft(textBoxOutput); if (finished != null) { finished(result); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), Resources.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public override void Select() { _command.Execute(); Console.ReadKey(); }