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(); var registry = RegistryManager.Instance(Main.Instance.CurrentInstance).registry; SortedDictionary <string, Repository> repositories = registry.Repositories; if (repositories.ContainsKey(name)) { repositories.Remove(name); } repositories.Add(name, new Repository(name, url, _sortedRepos.Count)); registry.Repositories = repositories; RefreshReposListBox(); } catch (Exception) { Main.Instance.currentUser.RaiseError("Invalid repo format - should be \"<name> | <url>\""); } } }
private void NewRepoButton_Click(object sender, EventArgs e) { var dialog = new NewRepoDialog(); if (dialog.ShowDialog() == DialogResult.OK) { try { var repo = dialog.Selection; var registry = RegistryManager.Instance(Main.Instance.CurrentInstance).registry; SortedDictionary <string, Repository> repositories = registry.Repositories; if (repositories.ContainsKey(repo.name)) { repositories.Remove(repo.name); } repositories.Add(repo.name, repo); registry.Repositories = repositories; RefreshReposListBox(); } catch (Exception) { Main.Instance.currentUser.RaiseError("Invalid repo format - should be \"<name> | <url>\""); } } }
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>\""); } } }