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());
     }
 }
Example #2
0
 public override void Select()
 {
     _command.Execute();
 }
Example #3
0
        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);
            }
        }
Example #4
0
 public override void Select()
 {
     _command.Execute();
     Console.ReadKey();
 }