private void btnAdd_Click(object sender, EventArgs e) { var tof = new ToolOptionsForm(null); if (tof.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var tp = tof.ToolParameters; tp.OrderIndex = listView1.Items.Count; var item = new ListViewItem(); FillListItem(item, tp); item.Tag = tp; listView1.Items.Add(item); } }
private void EditSelectedItem() { if (listView1.SelectedItems.Count > 0) { var item = listView1.SelectedItems[0]; var tp = (ToolParameters)item.Tag; var tof = new ToolOptionsForm(tp); if (tof.ShowDialog() == System.Windows.Forms.DialogResult.OK) { tp = tof.ToolParameters; item.Tag = tp; FillLists(GetDataFromUI()); } } }