protected Action AskQuestion(string question, Action <GrammarBuilder> matching, Action <RecognitionResult> answer, Action next) { var gb = new GrammarBuilder(); matching(gb); var grammar = new Grammar(gb); grammar.Enabled = false; recognizer.LoadGrammar(grammar); grammar.SpeechRecognized += (s, e) => { if (Recognition.ProcessCommand(e.Result)) { DisableGrammar(grammar); answer(e.Result); next(); } }; return(() => { grammar.Enabled = true; synthesizer.SpeakAsync(question); timer = new Timer(DisableGrammar, grammar, 15000, Timeout.Infinite); }); }