Esempio n. 1
0
 private void Ask(string property, IReadOnlyList <string> variants)
 {
     _currentAnswer              = null;
     DetailsLabel.Text           = $"Укажите: {property}";
     DetailsListBox.DataSource   = variants;
     DetailsListBox.SelectedItem = variants.First();
     DetailsGroupBox.Show();
 }
Esempio n. 2
0
        private async void RunButton_Click(object sender, EventArgs e)
        {
            var targetProperty = QuestionComboBox.SelectedItem.ToString();
            var result         = await Engine.AnalyzeAsync(targetProperty);

            DetailsGroupBox.Hide();

            if (result == null)
            {
                MessageBox.Show("Невозможно найти результат");
            }
            else
            {
                MessageBox.Show($"Результат: {result}");
            }
        }
Esempio n. 3
0
        public MainForm()
        {
            InitializeComponent();

            //set working directory for WinForm project to ../../../
            Knowledge = EsParser.ParseKnowledge(File.ReadAllText("Assets/knowledge.txt"));
            Engine    = new InferenceEngine(Knowledge, (x, y) => AskAndAwait(x, y));

            var possibleQuestions = Knowledge.RulesByResultPropertyName
                                    .Where(x => x.Value.Any())
                                    .Select(x => x.Key as object)
                                    .ToArray();

            QuestionComboBox.Items.AddRange(possibleQuestions);
            QuestionComboBox.SelectedItem = possibleQuestions.First();
            DetailsGroupBox.Hide();
        }