private void editValue_Click(object sender, System.EventArgs e) { var termViewItem = listView1.SelectedItems[0]; var term = _terms[termViewItem.Index]; var editVariableValueForm = new EditVariableValueForm(term); editVariableValueForm.OnSaveVariableValue += (name, a, b, c, d) => { var trapFunc = term.AccessoryFunc as TrapFunc; if (trapFunc == null) { return(false); } if (trapFunc.A != a || trapFunc.B != b || trapFunc.C != c || trapFunc.D != d) { term.AccessoryFunc = new TrapFunc(a, b, c, d); } return(true); }; editVariableValueForm.ShowDialog(); RefreshFormListView(); }
private void addValue_Click(object sender, System.EventArgs e) { var addVariableValueForm = new EditVariableValueForm(); addVariableValueForm.OnSaveVariableValue += (name, a, b, c, d) => { if (_terms.Any(x => x.Name == name)) { return(false); } _terms.Add(new Term(name, a, b, c, d)); return(true); }; addVariableValueForm.ShowDialog(); RefreshFormListView(); }