private void ButtonNewServer_Click(object sender, EventArgs e) { using (var ns = new FormServer()) { var rv = ns.ShowDialog(); if (rv == DialogResult.OK) { var item = new ServerListViewItem(httpServer, cacheFile, ns.Description); listDescriptions.Items.Add(item); item.Load(); SaveConfig(); } } }
private void ButtonEdit_Click(object sender, EventArgs e) { var item = listDescriptions.SelectedItems[0] as ServerListViewItem; if (item == null) { return; } using (var ns = new FormServer(item.Description)) { var rv = ns.ShowDialog(); if (rv == DialogResult.OK) { var desc = ns.Description; Task.Factory.StartNew(() => { item.UpdateInfo(desc); SaveConfig(); }); } } }