Ejemplo n.º 1
0
        private void SpeechRecognized(object sender, ASR.Events.AnswerSelectedEventArgs e)
        {
            var dbHandler = new DbDataHandler();
            var result    = dbHandler.Handle(engine.AnswersCopy, new KeyValuePair <string, string>(e.FieldName, e.SelectedAnswer));

            if (result.Success)
            {
                foreach (var newValue in result.ValuesToAdd)
                {
                    engine.AddAnswer(newValue.Key, newValue.Value);
                }
                SetNewQuestion(e);
                currentVarrialbes.Varriables.Items.Clear();
                var answers = engine.AnswersCopy.ToArray();
                foreach (var field in answers)
                {
                    currentVarrialbes.Varriables.Items.Add(new { Name = field.Key, Value = field.Value });
                }
                CollectionViewSource.GetDefaultView(currentVarrialbes.Varriables.Items).Refresh();
            }
            else
            {
                SpeechNotRecognized(this, new EventArgs());
            }
        }