Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SpeechRecognizer.RecognizerUpdateReached Event

Event generated when the Windows Desktop Speech Technology recognition engine pauses to allow an atomic updated requested by RequestRecognizerUpdate.

Namespace: System.Speech.Recognition
Assembly: System.Speech (in system.speech.dll)

public event EventHandler<RecognizerUpdateReachedEventArgs> RecognizerUpdateReached
/** @event */
public void add_RecognizerUpdateReached (EventHandler<RecognizerUpdateReachedEventArgs> value)

/** @event */
public void remove_RecognizerUpdateReached (EventHandler<RecognizerUpdateReachedEventArgs> value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

Applications can supply an informational object to the handler of a RecognizerUpdateReached event by specifying a userToken argument when calling RequestRecognizerUpdate(Object) or RequestRecognizerUpdate(Object,TimeSpan).

A handler for RecognizerUpdateReached obtains the object through the UserToken property on the RecognizerUpdateReachedEventArgs passed to it.

RequestRecognizerUpdate can be called at any point in the recognition process, when a RecognizerUpdateReached event is generated depends on the state of recognition engine:

  • If the recognition engine is not currently processing audio, the RecognizerUpdateReached event will be generated and handled immediately, without pausing the engine.

  • If the recognition engine is processing only silence or babble, the recognition engine will pause quickly, the RecognizerUpdateReached event will then be generated and handled.

  • If the recognition engine is actually processing speech, after the recognition engine has finished processing the current audio input, the engine will pause and the RecognizerUpdateReached event will then be generated and handled.

The example below shows the subscription of an anonymousmethod that loads or unloads grammars when handling RecognizerUpdateReached events. The method queries its input arguments for a particular object (GrammarRequest) and on the basis of that object loads or unloads a specified grammar and updates the grammar display.

_recognizer.RecognizerUpdateReached +=
   delegate(object s, RecognizerUpdateReachedEventArgs args) {
       GrammarRequest request = args.UserToken as GrammarRequest; //cast and check if incoming type is a request
       if (request != null) { // We know this is a Grammar request now
   if (request.Grammar == null)
   throw new ArgumentException("Invalid grammar used.");
       }
       switch (request.RequestType) {

   case GrammarRequestType.LoadGrammar:
   RemoveDuplicateGrammar(request.Grammar);
   _recognizer.LoadGrammarAsync(request.Grammar);
   break;
   case GrammarRequestType.UnloadGrammar:
   _recognizer.UnloadGrammar(request.Grammar);
   UpdateGrammarTree(_grammarTreeView, _recognizer);
   //DisplayGrammarUnload(request.Grammar);
   break;
       }
   };

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2015 Microsoft