/// <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); } }
private void OpenExternalCommandsWindow() { var commandsWindow = new CommandsWindow() { DataContext = new CommandsWindowViewModel() }; commandsWindow.ShowDialog(); }