private void btnDecisionVariableAdd_Click(object sender, EventArgs e) { using (DecisionVariableDialog dialog = new DecisionVariableDialog()) { DialogResult result = dialog.ShowDialog(); switch (result) { // put in how you want the various results to be handled // if ok, then something like var x = dialog.MyX; case DialogResult.OK: { lpr.AddDecisionVariable(dialog.getName(), dialog.getDescription()); break; } case DialogResult.Cancel: { break; } } } UpdateDecisionVariableGroup(); }
private void lvDecisionVariable_DoubleClick(object sender, EventArgs e) { foreach (ListViewItem lvi in ((ListView)sender).SelectedItems) { int pos = lpr.getDecisionVariableIndex(lvi.Text); if (pos == -1) { return; } using (DecisionVariableDialog dialog = new DecisionVariableDialog(lpr.getDecisionVariables()[pos])) { DialogResult result = dialog.ShowDialog(); switch (result) { // put in how you want the various results to be handled // if ok, then something like var x = dialog.MyX; case DialogResult.OK: { lpr.ChangeDecisionVariable(pos, dialog.getName(), dialog.getDescription()); break; } case DialogResult.Cancel: { break; } } } } UpdateDecisionVariableGroup(); }