void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { waitingForSpeech = false; Console.WriteLine("recognised : " + e.Result.Text + " confidence = " + e.Result.Confidence); try { if (opponentGrammarList.Contains(e.Result.Grammar)) { if (e.Result.Confidence > minimum_name_voice_recognition_confidence) { CrewChief.getEvent("Opponents").respond(e.Result.Text); } else { crewChief.youWot(); } } else if (e.Result.Confidence > minimum_voice_recognition_confidence) { if (ResultContains(e.Result.Text, REPEAT_LAST_MESSAGE)) { crewChief.audioPlayer.repeatLastMessage(); } else { AbstractEvent abstractEvent = getEventForSpeech(e.Result.Text); if (abstractEvent != null) { abstractEvent.respond(e.Result.Text); } } } else { crewChief.youWot(); } } catch (Exception exception) { Console.WriteLine("Unable to respond - error message: " + exception.Message); } sre.RecognizeAsyncStop(); Thread.Sleep(500); if (voiceOptionEnum == MainWindow.VoiceOptionEnum.ALWAYS_ON) { Console.WriteLine("restarting speech recognition"); recognizeAsync(); } }