SpeechRecognizer.RequestCancelOperation() method
The RequestCancelOperation() method interrupts speech recognition and returns control to the caller. This method can be called at any point in the speech recognition process.
When the RequestCancelOperation() method is called, the SpeechRecognizer first fires the AudioCaptureStateChanged event with a State of SpeechRecognizerAudioCaptureState.Cancelling. It then discards all audio, interpreted text, and other data from the current session. When finished, it fires the AudioCaptureStateChanged event a second time with a state of SpeechRecognizerAudioCaptureState.Cancelled, and then returns control to the caller.
Example
The following example uses button click handlers to call the StopListeningAndProcessAudio() and RequestCancelOperation() methods, and handles the AudioCaptureStateChanged event for SpeechRecognizer SR. The AudioCaptureStateChanged event handler shows and hides the Stop and Cancel buttons based on their relevance to the current state of the speech recognition process.
Requirements
Minimum Supported Client | Windows 8 |
Required Extensions | Bing.Speech |
Namespace |