Jagamisviis:


Grammar.Enabled Property

Definition

Gets or sets a value that controls whether a Grammar can be used by a speech recognizer to perform recognition.

public:
 property bool Enabled { bool get(); void set(bool value); };
public bool Enabled { get; set; }
member this.Enabled : bool with get, set
Public Property Enabled As Boolean

Property Value

The Enabled property returns true if a speech recognizer can perform recognition using the speech recognition grammar; otherwise the property returns false. The default is true.

Examples

The following example writes information about a Grammar object to the console.

private static void DumpGrammarStatus(Grammar item)  
{  
  Console.WriteLine("Grammar name is {0}:", item.Name);  
  Console.WriteLine("  The Grammar {0} loaded.",  
    item.Loaded ? "is" : "is not");  
  Console.WriteLine("  The Grammar {0} enabled.",  
    item.Enabled ? "is" : "is not");  
  if (item.RuleName != null)  
  {  
    Console.WriteLine("  The root rule is {0}.", item.RuleName);  
  }  
  else  
  {  
    Console.WriteLine("  The Grammar does not specify a root rule.");  
  }  
}  

Remarks

An instance of Grammar may be enabled or disabled independently of being loaded by a speech recognition engine.

Applies to

See also