private void tsbAdd_Click(object sender, EventArgs e) { frmSubscribeConfigDialog frm = new frmSubscribeConfigDialog(); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ListViewItem item = new ListViewItem(); item.Tag = new ServerGroup() { Name = frm.GroupName, URL = frm.GrouURL }; item.Text = frm.GroupName; item.SubItems.Add(frm.GrouURL); lstData.Items.Add(item); } }
private void tsbModify_Click(object sender, EventArgs e) { if (lstData.SelectedItems.Count != 1) { return; } ListViewItem item = lstData.SelectedItems[0]; ServerGroup group = item.Tag as ServerGroup; frmSubscribeConfigDialog frm = new frmSubscribeConfigDialog(); frm.GroupName = group.Name; frm.GrouURL = group.URL; if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { group.Name = frm.GroupName; group.URL = frm.GrouURL; item.Text = group.Name; item.SubItems[1].Text = group.URL; } }