void button3_Click(object sender, EventArgs e) { Variable v = FVariable.ShowForm("", "", ""); if (v != null) { Add(v, true); } }
public static Variable ShowForm(string obj, string property, string value) { using (FVariable f = new FVariable()) { f.tObject.Text = obj; f.tProperty.Text = property; f.tValue.Text = value; if (f.ShowDialog() == DialogResult.OK && f.tProperty.Text.Trim() != "") { return(new Variable(f.tObject.Text, f.tProperty.Text, f.tValue.Text)); } } return(null); }
void listView1_DoubleClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count != 1) { button3_Click(sender, e); return; } ListViewItem it = listView1.SelectedItems[0]; Variable v = FVariable.ShowForm(it.Text, it.SubItems[1].Text, it.SubItems[2].Text); if (v != null) { listView1.Items.Remove(it); Add(v, true); } }