public static Equivalence Show(Equivalence e) { RuleDialog d = new RuleDialog(e); e = d.ShowDialog() == DialogResult.OK ? d.Value : null; d.Dispose(); return(e); }
//Display equivalent statements in the list below the Statement box public void ApplyRule(Equivalence rule) { if (HasEntry && rule != null) { List <Statement> list = rule.Equivalences(Entry); lstEquivalent.Items.Clear(); lstEquivalent.Items.AddRange(list.ToArray()); } }
private void addRuleMenuItem_Click(object sender, EventArgs e) { Equivalence rule = RuleDialog.Show(null); if (rule != null) { AddRule(rule); lstRules.SelectedIndex = lstRules.Items.Count - 1; } }
public RuleDialog(Equivalence e) { InitializeComponent(); Value = e; this.Text = e != null ? "Edit Equivalence Rule" : "Add Equivalence Rule"; if (!Statement.USE_SYMBOLS) { lblArrow.Text = "<=>"; } }
private void lstRules_SelectedIndexChanged(object sender, EventArgs e) { Equivalence sel = lstRules.SelectedItem as Equivalence; if (sel != null) { lblRule.Text = sel.Rule; editMenuItem.Visible = applyRuleMenuItem.Visible = removeRuleMenuItem.Visible = true; } else { lblRule.Text = ""; editMenuItem.Visible = applyRuleMenuItem.Visible = removeRuleMenuItem.Visible = false; } }
private void editMenuItem_Click(object sender, EventArgs e) { int sel = lstRules.SelectedIndex; if (sel < 0) { return; } Equivalence rule = RuleDialog.Show(lstRules.SelectedItem as Equivalence); if (rule != null) { lstRules.Items[sel] = rule; lstRules.SelectedIndex = sel; } }
//Add an equivalence rule to the list public void AddRule(Equivalence rule) { lstRules.Items.Add(rule); }