private void btnConstraintAdd_Click(object sender, EventArgs e) { using (ConstraintDialog dialog = new ConstraintDialog(lpr.ListDecisionVaraibleNames())) { 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: { //TODO::Change to fit constraints // lpr.ChangeConstraint(pos, dialog.getName(), dialog.getDescription()); dialog.ToLPREntry(); //lpr.AddConstraint(); break; } case DialogResult.Cancel: { break; } } } UpdateDecisionVariableGroup(); }
private void lvConstraints_DoubleClick(object sender, EventArgs e) { foreach (ListViewItem lvi in ((ListView)sender).SelectedItems) { int pos = lpr.getConstraintIndex(lvi.Text); if (pos == -1) { return; } using (ConstraintDialog dialog = new ConstraintDialog(lpr.getConstraints()[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: { //TODO::Change to fit constraints // lpr.ChangeConstraint(pos, dialog.getName(), dialog.getDescription()); break; } case DialogResult.Cancel: { break; } } } } UpdateDecisionVariableGroup(); }