private void editLdapServerButton_Click(object sender, EventArgs e) { // If the "Create new server..." item is currently selected, then create a new server and early out if (IsCreateNewServerSelected) { CreateNewServer(); UpdateSelectedServer(); return; } // Edit current LDAP server info DirectoryAnalyzer analyzer = (DirectoryAnalyzer)ldapServerCombo.SelectedItem; LdapServerInformation info = (LdapServerInformation)analyzer.CreationInfo.Clone(); ServerEditor setupDlg = new ServerEditor(info); if (setupDlg.ShowDialog() == DialogResult.OK) { analyzer.ChangeServerInformation(info); info.SaveToRegistry(); } PopulateLdapServerList(analyzer); }
private void CreateNewServer() { LdapServerInformation ls = new LdapServerInformation(); ServerEditor setupDlg = new ServerEditor(ls); if (setupDlg.ShowDialog() == DialogResult.OK) { ls.SaveToRegistry(); // Add the new analyzer to the analyzer list DirectoryAnalyzer newAnalyzer = new DirectoryAnalyzer(ls); DirectoryAnalyzers.Instance.Add(newAnalyzer); // Add the new analyzer to the combo box, and select it ldapServerCombo.Items.Insert(0, newAnalyzer); ldapServerCombo.SelectedIndex = 0; } }