EmulateRecognizeCompletedEventArgs Class

Provides data for the EmulateRecognizeCompleted event.


Namespace:  Microsoft.Speech.Recognition
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

public class EmulateRecognizeCompletedEventArgs : AsyncCompletedEventArgs

An instance of EmulateRecognizeCompletedEventArgs is created when the SpeechRecognitionEngine object raises the EmulateRecognizeCompleted event. To obtain information about the result of recognition, access the Result property in the handler for the event.

Emulation is a process that provides text, instead of audio, as the input to a speech recognition engine. To bypass the audio inputs for a SpeechRecognitionEngine object during emulation, use the SetInputToNull() method.

If the speech recognition engine encounters an exception during the recognition operation, the Error property is set to the exception and the Result property is set to a null reference (Nothing in Visual Basic).

EmulateRecognizeCompletedEventArgs derives from AsyncCompletedEventArgs.

The following example adds an event handler for the EmulateRecognizeCompleted event to a SpeechRecognitionEngine. The handler gets the recognized text from the Result property.

private SpeechRecognitionEngine sre;

// Initialize the speech recognition engine. 
private void Initialize()
  sre = new SpeechRecognitionEngine();

  // Add a handler for the EmulateRecognizeCompleted event.
  sre.EmulateRecognizeCompleted += new EventHandler<EmulateRecognizeCompletedEventArgs>(sre_EmulateRecognizeCompleted);

  // Add other initialization code here.

// Handle the EmulateRecognizeCompleted event. 
void sre_EmulateRecognizeCompleted(object sender, EmulateRecognizeCompletedEventArgs e)
  if (e.Result == null) return;

  string phrase = e.Result.Text;

  // Add event handler code here.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.