/// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            GitCommandExecuter gitExecuter = new GitCommandExecuter(_gitService);
            GitCommandResult   result      = gitExecuter.Execute(ExtensionConstants.PullOriginDevelopment);

            BringPanelToFront();

            WriteLineToOutputWindow("########################################");
            if (result.IsError)
            {
                WriteLineToOutputWindow($"Git Error - at {DateTime.Now}");
                WriteLineToOutputWindow(result.ErrorMessage);
            }
            else
            {
                WriteLineToOutputWindow($"Git Command OK - at {DateTime.Now}");
            }
            WriteLineToOutputWindow("########################################");
            WriteLineToOutputWindow(String.Empty);

            WriteLineToOutputWindow(result.OutputMessage);
            WriteLineToOutputWindow(String.Empty);
            WriteLineToOutputWindow(String.Empty);
        }
Example #2
0
 /// <summary>Depending on a git command's result, publishes a notification.</summary>
 /// <param name="result">Result of the git command.</param>
 /// <param name="successNotification">Notification to publish if successful.</param>
 /// <param name="failNotification">Notification to publish if failed.</param>
 protected void NotifyIf(
     GitCommandResult result,
     Func <Notification> successNotification,
     Func <Notification> failNotification)
 {
     Notifier.NotifyIf(result, successNotification, failNotification);
 }
Example #3
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            CommandsWindow window = new CommandsWindow();

            window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            window.ShowDialog();

            if (window.SelectedGitCommand != null)
            {
                var gitCommand = window.SelectedGitCommand;
                GitCommandExecuter gitExecuter = new GitCommandExecuter(_gitService);
                GitCommandResult   result      = gitExecuter.Execute(gitCommand);

                BringPanelToFront();

                WriteLineToOutputWindow("########################################");
                if (result.IsError)
                {
                    WriteLineToOutputWindow($"Git Error - at {DateTime.Now}");
                    WriteLineToOutputWindow(result.ErrorMessage);
                }
                else
                {
                    WriteLineToOutputWindow($"Git Command OK - at {DateTime.Now}");
                }
                WriteLineToOutputWindow("########################################");
                WriteLineToOutputWindow(String.Empty);

                WriteLineToOutputWindow(result.OutputMessage);
                WriteLineToOutputWindow(String.Empty);
                WriteLineToOutputWindow(String.Empty);
            }
        }
Example #4
0
 /// <summary>Depending on a git command's result, publishes a notification.</summary>
 /// <param name="notifier">Notifier to publish to.</param>
 /// <param name="result">Result of the git command.</param>
 /// <param name="successNotification">Notification to publish if successful.</param>
 /// <param name="failNotification">Notification to publish if failed.</param>
 public static void NotifyIf(this INotifier notifier,
                             GitCommandResult result,
                             Func <Notification> successNotification,
                             Func <Notification> failNotification)
 {
     if (result.WasSuccessful && successNotification != null)
     {// successful AND success notification -> notify
         notifier.Notify(successNotification());
     }
     else if (result.WasSuccessful == false && failNotification != null)
     {// failed AND fail notification -> notify
         notifier.Notify(failNotification());
     }
 }