示例#1
0
        /// <summary>
        /// добавление правила
        /// </summary>
        private void RAdd_Click(object sender, RoutedEventArgs e)
        {
            if (RIf.Text.Length > 0 && RThen.SelectedItem != null)
            {
                List <Fact> fl = new List <Fact>();
                string      s  = RIf.Text;
                string[]    t  = s.Split('&');
                foreach (string k in t)
                {
                    fl.Add(knowlegeBase.Facts.Find(x => x.Title == k));
                }
                Conclusion c = new Conclusion();
                c.Title = RThen.SelectedItem.ToString();

                ////////формирование строки
                string rule = string.Empty;
                rule += "IF (";
                foreach (var fact in fl)
                {
                    rule += fact + "&";
                }
                rule  = rule.Substring(0, rule.Length - 1);
                rule += ") THEN " + c;
                ////////
                knowlegeBase.RulesViews.Add(rule);
                XMLDataLoader.Serialize(knowlegeBase);
                Load_CB();
                FQ.Clear();
            }
        }
示例#2
0
        /// <summary>
        /// добавление правила
        /// </summary>
        private void RAdd_Click(object sender, RoutedEventArgs e)
        {
            if (RIf.Text.Length > 0 && RThen.SelectedItem != null)
            {
                List<Fact> fl = new List<Fact>();
                string s = RIf.Text;
                string[] t = s.Split('&');
                foreach (string k in t)
                {
                    fl.Add(knowlegeBase.Facts.Find(x => x.Title == k));
                }
                Conclusion c = new Conclusion();
                c.Title = RThen.SelectedItem.ToString();

                ////////формирование строки
                string rule = string.Empty;
                rule += "IF (";
                foreach (var fact in fl)
                {
                    rule += fact + "&";
                }
                rule = rule.Substring(0, rule.Length - 1);
                rule += ") THEN " + c;
                ////////
                knowlegeBase.RulesViews.Add(rule);
                XMLDataLoader.Serialize(knowlegeBase);
                Load_CB();
                FQ.Clear();
            }
        }
示例#3
0
 /// <summary>
 /// добавление вывода
 /// </summary>
 private void CAdd_Click(object sender, RoutedEventArgs e)
 {
     if (CT.Text.Length > 0)
     {
         Conclusion c = new Conclusion();
         c.Title = CT.Text;
         knowlegeBase.Conclusions.Add(c);
         XMLDataLoader.Serialize(knowlegeBase);
         Load_CB();
         CT.Clear();
     }
 }
示例#4
0
 /// <summary>
 /// добавление вывода
 /// </summary>
 private void CAdd_Click(object sender, RoutedEventArgs e)
 {
     if (CT.Text.Length > 0)
     {
         Conclusion c = new Conclusion();
         c.Title = CT.Text;
         knowlegeBase.Conclusions.Add(c);
         XMLDataLoader.Serialize(knowlegeBase);
         Load_CB();
         CT.Clear();
     }
 }