private SpeechRecognitionEngine createSpeechRecogntionEngine(MainSystemTray form) { SpeechRecognitionEngine newSpeechRecognizer = new SpeechRecognitionEngine(CultureInfo.CurrentCulture); //Setting up the grammars for the voice recognizer Grammar commandGrammar = createCommandGrammar(); commandGrammar.Weight = 1f; //"grammar:dictation#pronunciation" Grammar dictationGrammar = new DictationGrammar("grammar:dictation"); dictationGrammar.Name = DictationState.GRAMMARNAME; dictationGrammar.Weight = .3f; //Setting up the voice recognizer to start listening for commands and send them to the SpeechRecognised method newSpeechRecognizer.RequestRecognizerUpdate(); newSpeechRecognizer.LoadGrammar(commandGrammar); newSpeechRecognizer.LoadGrammar(dictationGrammar); try { newSpeechRecognizer.SetInputToDefaultAudioDevice(); newSpeechRecognizer.RecognizeAsync(RecognizeMode.Multiple); } catch (System.InvalidOperationException) { if (MessageBox.Show( "You do not have an audio capture device installed \nPlease install a microphone and restart the program", "No Capture Device", MessageBoxButtons.OK) == DialogResult.OK) { form.ExitProgram(); } } return(newSpeechRecognizer); }