This documentation is archived and is not being maintained.

SpeechRecognizer.Enabled Property

Gets or sets a value controlling whether a SpeechRecognizer is enabled an running.

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

public bool Enabled { get; set; }
/** @property */
public boolean get_Enabled ()

/** @property */
public void set_Enabled (boolean value)

public function get Enabled () : boolean

public function set Enabled (value : boolean)

Not applicable.

Property Value

Property is a bool value which is set to true if an instance of SpeechRecognizer is enabled and ready to process input, and false it the instance is not available for input processing.

The value of SpeechRecognizer controls the state of the Windows Desktop Speech Technology across the system: for example, if an application sets Enabled to false, Windows Desktop Speech Technology is disabled for all other applications on the system.

No audio data is added to the buffer managed by the Windows Desktop Speech Technology recognition engines accessed by the SpeechRecognizer object if Enabled is set to false: after that point all input will be lost until Enabled is set to true.

When the Windows Desktop Speech Technology recognition engine is reenabled by setting Enabled to true, the engine's buffer maintained for that instance of SpeechRecognizer is empty and the audio input stream position is set to zero.

Compare this behavior with the behavior of the Windows Desktop Speech Technology when PauseRecognizerOnRecognition is modified.

The example below shows a button click handler that enables and disables the current SpeechRecognizer.

.
private void ListenButton_Click(object sender, EventArgs e)
{
  if (_listenButton.Text == "Listen")  // Start listening.
    {
      // Update listenButton text.
      _listenButton.Text = "Stop";
      
      // Enable recognition of grammars.
      _recognizer.Enabled = true;
    }
  else                                // Stop listening.
    {
      // Update listenButton text.
      _listenButton.Text = "Listen";
      
      // Disable recognition of grammars.
      _recognizer.Enabled = false;
      
    }
}

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
Show: