public static void StopListeningExcept(Choices ch, Func RaiseFunc) { sre.UnloadAllGrammars(); ch.Add(new string[] { "Hello David", "Hello Zira" }); WatchForAndRaise(ch, RaiseFunc); Mouth.Speak("here when you need me"); }
static void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { if (e.Result.Text == "Hello David") { Mouth.SetSpeaker("Microsoft David Desktop"); Mouth.Speak("Hello " + Environment.MachineName); return; } else if (e.Result.Text == "Hello Zira") { Mouth.SetSpeaker("Microsoft Zira Desktop"); Mouth.Speak("Hello " + Environment.MachineName); return; } Recognised(e.Result.Text); }