Delen via


SpeechRecognizer.LoadGrammarAsync(Grammar) Method

Definition

Asynchronously loads a speech recognition grammar.

public:
 void LoadGrammarAsync(System::Speech::Recognition::Grammar ^ grammar);
public void LoadGrammarAsync (System.Speech.Recognition.Grammar grammar);
member this.LoadGrammarAsync : System.Speech.Recognition.Grammar -> unit
Public Sub LoadGrammarAsync (grammar As Grammar)

Parameters

grammar
Grammar

The speech recognition grammar to load.

Remarks

When the recognizer completes this asynchronous operation, it raises a LoadGrammarCompleted event. The recognizer throws an exception if the speech recognition grammar is already loaded, is being asynchronously loaded, or has failed to load into any recognizer. If the recognizer is running, applications must use RequestRecognizerUpdate to pause the speech recognition engine before loading, unloading, enabling, or disabling a grammar.

To load a speech recognition grammar synchronously, use the LoadGrammar method.

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by LoadGrammar(Grammar).

Applies to

See also