SpeechRecognitionEngine::LoadGrammarAsync Method (Grammar^)
Asynchronously loads a speech recognition grammar.
Assembly: System.Speech (in System.Speech.dll)
Parameters
- grammar
-
Type:
System.Speech.Recognition::Grammar^
The speech recognition grammar to load.
| Exception | Condition |
|---|---|
| ArgumentNullException | Grammar is null. |
| InvalidOperationException | Grammar is not in a valid state. |
| OperationCanceledException | The asynchronous operation was canceled. |
When the recognizer completes loading a Grammar object, it raises a LoadGrammarCompleted event. The recognizer throws an exception if the Grammar object is already loaded, is being asynchronously loaded, or has failed to load into any recognizer. You cannot load the same Grammar object into multiple instances of SpeechRecognitionEngine. Instead, create a new Grammar object for each SpeechRecognitionEngine instance.
If the recognizer is running, applications must use RequestRecognizerUpdate to pause the speech recognition engine before loading, unloading, enabling, or disabling a grammar.
When you load a grammar, it is enabled by default. To disable a loaded grammar, use the Enabled property.
To load a speech recognition grammar synchronously, use the LoadGrammar method.
Available since 3.0