public void SpeechRecognised(object sender, SpeechRecognizedEventArgs e) { if (controlState.GetType() == typeof(CommandState) && e.Result.Grammar.Name == "command") { controlState.VoiceInput(e.Result.Text); } else if (controlState.GetType() == typeof(DictationState) && e.Result.Grammar.Name == "dictation") { controlState.VoiceInput(e.Result.Text); } }