GitUI.FormCheckoutBranch.OkClick C# (CSharp) Метод

OkClick() приватный Метод

private OkClick ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        private void OkClick(object sender, EventArgs e)
        {
            try
            {
                var command = "checkout";
                if (Remotebranch.Checked)
                {
                    //Get a localbranch name
                    var remoteName = GitCommands.GitCommands.GetRemoteName(Branches.Text, GitCommands.GitCommands.GetRemotes());
                    var localBranchName = Branches.Text.Substring(remoteName.Length + 1);

                    //try to determine the 'best' name for a local branch, check if the local
                    //name for the remote branch is already used
                    if (LocalBranchExists(localBranchName))
                        localBranchName = string.Concat(remoteName, "_", localBranchName);

                    var result = MessageBox.Show(string.Format(trackRemoteBranch.Text, localBranchName), trackRemoteBranchCaption.Text, MessageBoxButtons.YesNoCancel);

                    if (result == DialogResult.Cancel)
                        return;

                    if (result == DialogResult.Yes)
                        command += string.Format(" -b {0}", localBranchName);
                }

                if (Force.Checked)
                    command += " --force";
                command += " \"" + Branches.Text + "\"";
                var form = new FormProcess(command);
                form.ShowDialog();
                if (!form.ErrorOccured())
                    Close();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }