GitUI.FormRemotes.SaveClick C# (CSharp) Method

SaveClick() private method

private SaveClick ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void SaveClick(object sender, EventArgs e)
        {
            var output = "";

            if (string.IsNullOrEmpty(_remote))
            {
                if (string.IsNullOrEmpty(RemoteName.Text) && string.IsNullOrEmpty(Url.Text))
                    return;

                output = GitCommands.GitCommands.AddRemote(RemoteName.Text, Url.Text);

                if (MessageBox.Show(
                        "You have added a new remote repository." + Environment.NewLine +
                        "Do you want to automaticly configure the default push and pull behaviour for this remote?",
                        "New remote", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    var remoteUrl = Url.Text;

                    if (!string.IsNullOrEmpty(remoteUrl))
                    {
                        new FormProcess("remote update").ShowDialog();
                        ConfigureRemotes();
                    }
                    else
                        MessageBox.Show("You need to configure a valid url for this remote", "Url needed");
                }
            }
            else
            {
                if (RemoteName.Text != _remote)
                {
                    output = GitCommands.GitCommands.RenameRemote(_remote, RemoteName.Text);
                }

                GitCommands.GitCommands.SetSetting(string.Format("remote.{0}.url", RemoteName.Text), Url.Text);
                GitCommands.GitCommands.SetSetting(string.Format("remote.{0}.puttykeyfile", RemoteName.Text), PuttySshKey.Text);
            }

            if (!string.IsNullOrEmpty(output))
                MessageBox.Show(output, "Delete");

            Initialize();
        }