// ================================================================= // UI Events // ================================================================= private void ButtonAccept_Click(object sender, EventArgs e) { // error checks string repoName = TextBoxRepoName.Text; if (repoName == null) { return; } if (repoName.Equals("")) { return; } if (repoName.Equals("Repository Name")) { return; } string localDir = TextBoxLocalDirectory.Text; if (localDir == null) { return; } if (localDir.Equals("")) { return; } localDir = localDir.Replace(@"\", "/"); string server = ComboBoxSelectServer.GetItemText(ComboBoxSelectServer.SelectedItem); if (server == null) { return; } if (server.Equals("")) { return; } // get server details ListItem listitem = (ListItem)(ComboBoxSelectServer.SelectedItem); ServerDetails sd = listitem.Details; // check to see if sevrer is available RemoteManager rman = RemoteManager.GetInstance(); IRemote remote = rman.Connect(sd); if (!remote.IsConnected()) // error { DialogUtil.Message("Error: Cannot connect to remote repository"); return; } // make and run the script for downloading the selected repository string remoteDir = sd.GetServerLoginString() + "/" + repoName; RepoDetails repo = new RepoDetails(repoName, sd.GetName(), remoteDir, localDir); string script = ScriptBuilder.CloneScript(repo, sd); Executable exe = new Executable("expect.exe", script).Start(); exe.WaitForExit(); // add new repo to configuration ReposConfig.GetInstance().AddRepoDetails(repo, false); ReposConfig.GetInstance().Save(); // done. now close and fire refresh event EventManager.Fire(EventCode.REFRESH_REPOS); ProperClose(); }