示例#1
0
        private void ButtonChangeConclusionClick(object sender, EventArgs e)
        {
            var factForm = new FactForm();

            factForm.KnowledgeBase = KnowledgeBase;
            factForm.IsConclusion  = true;
            factForm.Fact          = (Fact)listBoxConclusion.SelectedItem;
            var dialogResult = factForm.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                _rule.Conclusion[listBoxConclusion.SelectedIndex]        = factForm.Fact;
                listBoxConclusion.Items[listBoxConclusion.SelectedIndex] = factForm.Fact;
            }

            richTextBoxReason.Text = _rule.Reason;
        }
示例#2
0
        private void ButtonAddConclusionClick(object sender, EventArgs e)
        {
            var factForm = new FactForm();

            factForm.KnowledgeBase = KnowledgeBase;
            factForm.IsConclusion  = true;
            var dialogResult = factForm.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                if (listBoxConclusion.SelectedIndex >= 0)
                {
                    _rule.Conclusion.Insert(listBoxConclusion.SelectedIndex, factForm.Fact);
                    listBoxConclusion.Items.Insert(listBoxConclusion.SelectedIndex, factForm.Fact);
                }
                else
                {
                    _rule.Conclusion.Add(factForm.Fact);
                    listBoxConclusion.Items.Add(factForm.Fact);
                }
            }

            richTextBoxReason.Text = _rule.Reason;
        }