示例#1
0
        private void StartProcess()
        {
            Inference.Calculate(rules);
            Inference.UnsetUnknownFacts(rules);
            stackPanel = new StackPanel
            {
                Orientation = Orientation.Vertical
            };

            stackPanel1 = new StackPanel
            {
                Orientation = Orientation.Vertical
            };


            List <Predicate> tmpFacts       = new List <Predicate>();
            List <Predicate> tmpConclusions = new List <Predicate>();

            foreach (Rule rule in rules)
            {
                foreach (Predicate fact in rule.Facts)
                {
                    if (CheckFact(fact.Name) && !tmpFacts.Any(f => f.Name == fact.Name))
                    {
                        CheckBox cb = new CheckBox();
                        cb.IsChecked = fact.Value;
                        stackPanel.Children.Add(cb);

                        tmpFacts.Add(fact);
                    }
                }
                foreach (Predicate conclusion in rule.Conclusions)
                {
                    CheckBox cb = new CheckBox();
                    cb.IsChecked = conclusion.Value;
                    stackPanel1.Children.Add(cb);

                    tmpConclusions.Add(conclusion);
                }
            }
            Facts       = new List <Predicate>(tmpFacts);
            Conclusions = new List <Predicate>(tmpConclusions);
        }