我在我的程序中添加了语音识别功能。但是,如果我尝试运行程序并且语音属性中的语言设置为“Microsoft Speech Recognizer 8.0 for Windows (English - US)”以外的任何内容,则程序无法加载。
我想拥有它,以便无论选择哪种语言,程序都会加载。
我的语音命令代码如下:
vcstat.Text = "Voice Control Enabled";
recognizer = new SpeechRecognizer();
recognizer.SpeechDetected += recognizer_SpeechDetected;
recognizer.SpeechRecognitionRejected += recognizer_SpeechRecognitionRejected;
recognizer.SpeechRecognized += recognizer_SpeechRecognized;
GrammarBuilder grammar = new GrammarBuilder();
grammar.Append(new Choices("Cut", "Copy", "Paste", "Select All Text", "Print", "Unselect All Text", "Delete", "Save", "Save As", "Open", "New", "Close Basic Word Processor"));
recognizer.LoadGrammar(new Grammar(grammar));
还有一些代码,但这与实际命令有关,所以我认为没有必要在这里发布。
如果有人可以帮助我找出一种方法来允许程序启动,无论使用何种语音识别引擎,我都会非常感激。