示例#1
0
        public static Equivalence Show(Equivalence e)
        {
            RuleDialog d = new RuleDialog(e);

            e = d.ShowDialog() == DialogResult.OK ? d.Value : null;
            d.Dispose();
            return(e);
        }
示例#2
0
 //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());
     }
 }
示例#3
0
        private void addRuleMenuItem_Click(object sender, EventArgs e)
        {
            Equivalence rule = RuleDialog.Show(null);

            if (rule != null)
            {
                AddRule(rule);
                lstRules.SelectedIndex = lstRules.Items.Count - 1;
            }
        }
示例#4
0
 public RuleDialog(Equivalence e)
 {
     InitializeComponent();
     Value     = e;
     this.Text = e != null ? "Edit Equivalence Rule" : "Add Equivalence Rule";
     if (!Statement.USE_SYMBOLS)
     {
         lblArrow.Text = "<=>";
     }
 }
示例#5
0
        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;
            }
        }
示例#6
0
        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;
            }
        }
示例#7
0
 //Add an equivalence rule to the list
 public void AddRule(Equivalence rule)
 {
     lstRules.Items.Add(rule);
 }