/// <summary> /// Set the UI based on the current state of the speech state machine /// </summary> /// <param name="state"></param> private void SpeechSetUIState(SpeechHelper.SpeechState state) { switch (state) { case SpeechHelper.SpeechState.Initializing: SpeechLabelText = "initializing..."; SpeechButtonText = "done"; SpeechButtonEnabled = false; SpeechCancelButtonText = "cancel"; break; case SpeechHelper.SpeechState.Listening: SpeechLabelText = "listening..."; SpeechButtonText = "done"; SpeechButtonEnabled = true; SpeechCancelButtonText = "cancel"; break; case SpeechHelper.SpeechState.Recognizing: SpeechLabelText = "recognizing..."; SpeechButtonText = "try again"; SpeechButtonEnabled = false; SpeechCancelButtonText = "cancel"; break; case SpeechHelper.SpeechState.Finished: SpeechLabelText = ""; SpeechButtonText = "try again"; SpeechButtonEnabled = true; SpeechCancelButtonText = "ok"; break; } }
private void SpeechPopup_SpeechStateCallback(SpeechHelper.SpeechState state, string message) { speechState = state; SpeechSetUIState(speechState); // store debug / timing info TimeSpan ts = DateTime.Now - speechStart; string stateString = SpeechHelper.SpeechStateString(state); speechDebugString += String.Format("New state: {0}; Time: {1}; Message: {2}\n", stateString, ts.TotalSeconds, message); }