示例#1
0
        private GitCommandEntry CreateGitCommandEntry(GitContextMenuCommand gitCommand)
        {
            GitCommandEntry gitCommandEntry = new GitCommandEntry(gitCommand);

            gitCommandEntry.Action  += GitCommandEntry_Action;
            gitCommandEntry.Changed += GitCommandEntry_Changed;
            return(gitCommandEntry);
        }
示例#2
0
        private async void GitCommand_Click(object sender, EventArgs eventArgs)
        {
            GitContextMenuCommand gitCommand = sender.GetTagValue <GitContextMenuCommand>();

            if (gitCommand == null)
            {
                return;
            }

            BeginExecutingGitCommand();

            (bool Success, string[] ErrorOutput)result;

            try
            {
                string command = gitCommand.Command.Replace(Settings.BRANCH_IDENTIFIER, Branch);

                if (Settings.Default.ShowGitCommandOutput)
                {
                    using (OutputForm errorForm = new OutputForm(outputHandler =>
                                                                 Root.SafeGitExecuteAsync(Path, command, outputHandler.AddLine),
                                                                 showInTaskbar: true))
                    {
                        errorForm.ShowDialog(this);
                        result = errorForm.OperationResult;
                    }
                }
                else
                {
                    result = await Root.SafeGitExecuteAsync(Path, command);
                }
            }
            finally
            {
                DoneExecutingGitCommand();
            }

            if (result.Success)
            {
                await RefreshInfo(resetRemoteStatus : false);
            }
            else if (!Settings.Default.ShowGitCommandOutput)
            {
                using (OutputForm errorForm = new OutputForm(result.ErrorOutput, showInTaskbar: true))
                {
                    errorForm.ShowDialog(this);
                }
            }
        }
 public GitCommandEntry(GitContextMenuCommand gitCommand)
 {
     InitializeComponent();
     GitCommand = gitCommand;
     UpdateInfo();
 }