private void editToolStripMenuItem_Click(object sender, EventArgs e) { if (list.SelectedItem != null) { ServerDialog dlg = new ServerDialog(true); dlg.ServerData = SelectedServer; if (dlg.ShowDialog() == DialogResult.OK) { dlg.ServerData.Save(settings); } } UpdateList(); }
private void addToolStripMenuItem_Click(object sender, EventArgs e) { ServerDialog dlg = new ServerDialog(false); ShowDialog: if (dlg.ShowDialog() == DialogResult.OK) { Server server = dlg.ServerData; if (!settings.ElementExists("Servers", server.Element) || MessageBox.Show("Server with name \"" + server.Name + "\" already exists. Overwrite?", "Error", MessageBoxButtons.YesNo) == DialogResult.Yes) { server.Save(settings); } else { goto ShowDialog; } } UpdateList(); }