private void NewRepoButton_Click(object sender, EventArgs e) { var dialog = new NewRepoDialog(); if (dialog.ShowDialog() == DialogResult.OK) { try { var repo = dialog.RepoUrlTextBox.Text.Split('|'); var name = repo[0].Trim(); var url = repo[1].Trim(); SortedDictionary<string, Repository> repositories = Main.Instance.CurrentInstance.Registry.Repositories; if (repositories.ContainsKey(name)) { repositories.Remove(name); } repositories.Add(name, new Repository(name, url)); Main.Instance.CurrentInstance.Registry.Repositories = repositories; RefreshReposListBox(); } catch (Exception) { Main.Instance.m_User.RaiseError("Invalid repo format - should be \"<name> | <url>\""); } } }