private void tsEdit_Click(object sender, EventArgs e) { if (lvwMonitorItems.SelectedItems.Count > 0) { ListViewItem selecteditem = lvwMonitorItems.SelectedItems[0]; MonitorConfigurationItem mci = selecteditem.Tag as MonitorConfigurationItem; if (EditMonitorItem.EditItem(this, mci)) { RefreshItem(selecteditem); } } }
private void tsNewItem_Click(object sender, EventArgs e) { MonitorConfigurationItem mci = new MonitorConfigurationItem(); ListViewItem newitem = BuildItem(mci); lvwMonitorItems.Items.Add(newitem); if (EditMonitorItem.EditItem(this, mci)) { RefreshItem(newitem); } else { lvwMonitorItems.Items.Remove(newitem); } }
public static bool EditItem(IWin32Window owner, MonitorConfigurationItem mciitem) { EditMonitorItem dlgUse = new EditMonitorItem(mciitem); return(dlgUse.ShowDialog(owner) == System.Windows.Forms.DialogResult.OK); }