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}"); } }
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(); }