SpeechRecognizer 会直接调用系统的语音监听器。Choices 在其上可以正常工作。
SpeechRecognitionEngine 则不会,但是更灵活。Choices 目前没好使过。DictationGrammar在其上可以正常运行。
但是
GrammarBuilder grammarBuilder = new GrammarBuilder();
grammarBuilder.Append(new Choices("张三"));
grammarBuilder.Append(new Choices("李四"));
grammarBuilder.Append(new Choices("王五"));
grammarBuilder.Append(new Choices("局长"));
Grammar g = new Grammar(grammarBuilder);
g.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(g_SpeechRecognized);
sh.SetGrammar(g);
类似这样的代码就是没有反应。