private void OkClick(object sender, EventArgs e)
{
try
{
Cursor = Cursors.Default;
branchListLoader.Cancel();
var dirTo = _NO_TRANSLATE_To.Text;
if (!dirTo.EndsWith(Settings.PathSeparator.ToString()) && !dirTo.EndsWith(Settings.PathSeparatorWrong.ToString()))
{
dirTo += Settings.PathSeparator.ToString();
}
dirTo += _NO_TRANSLATE_NewDirectory.Text;
Repositories.AddMostRecentRepository(_NO_TRANSLATE_From.Text);
Repositories.AddMostRecentRepository(dirTo);
if (!Directory.Exists(dirTo))
{
Directory.CreateDirectory(dirTo);
}
var cloneCmd = GitCommandHelpers.CloneCmd(_NO_TRANSLATE_From.Text, dirTo,
CentralRepository.Checked, cbIntializeAllSubmodules.Checked, Branches.Text, null);
using (var fromProcess = new FormRemoteProcess(Module, Settings.GitCommand, cloneCmd))
{
fromProcess.SetUrlTryingToConnect(_NO_TRANSLATE_From.Text);
fromProcess.ShowDialog(this);
if (fromProcess.ErrorOccurred() || Module.InTheMiddleOfPatch())
{
return;
}
}
if (openedFromProtocolHandler && AskIfNewRepositoryShouldBeOpened(dirTo))
{
Hide();
GitUICommands uiCommands = new GitUICommands(dirTo);
uiCommands.StartBrowseDialog();
}
else if (ShowInTaskbar == false && AskIfNewRepositoryShouldBeOpened(dirTo))
{
if (GitModuleChanged != null)
{
GitModuleChanged(new GitModule(dirTo));
}
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(this, "Exception: " + ex.Message, "Clone failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}