private void addServerToolStripMenuItem_Click(object sender, EventArgs e) { var srv = new HostConfiguration(); srv.ShowDialog(); if (srv.Canceled == false) { config.DSMHosts.Items.Add(srv.Host); config.CurrentConfiguration.Save(); PopulateServerTree(); } }
private void addServerToolStripMenuItem_Click(object sender, EventArgs e) { using (var srv = new HostConfiguration()) { srv.ShowDialog(); if (srv.Canceled == false) { if (Profile.DSMHosts.Items.ContainsKey(srv.Host.Host) == false) { Profile.DSMHosts.Items.Add(srv.Host); Profile.Save(); PopulateServerTree(); } else { MessageBox.Show(string.Format("There is already a configuration present for the host named '{0}'", srv.Host.Host), "Duplicate host", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } }