RecognizeMode 枚举

定义

枚举识别模式的值。Enumerates values of the recognition mode.

public enum class RecognizeMode
public enum RecognizeMode
type RecognizeMode = 
Public Enum RecognizeMode
继承
RecognizeMode

字段

Multiple 1

指定了不在完成之后终止的识别。Specifies that recognition does not terminate after completion.

Single 0

指定了不在完成之后终止的识别。Specifies that recognition terminates after completion.

示例

下面的示例演示如何实现具有图形用户界面并使用SpeechRecognitionEngine的应用程序的 "开始/停止" 按钮。The following example shows the implementation of a start/stop button for an application that has a graphical user interface and uses SpeechRecognitionEngine. 根据应用程序的状态, 在单击RecognizeAsync(RecognizeMode)该按钮时, 将会调用 "单个" 或 "多个"。Depending on the state of the application, RecognizeAsync(RecognizeMode) is called with either Single or Multiple when the button is clicked.

private void _startRecogButton_Click(object sender, EventArgs eventArgs)   
{  
  
  // Toggle speech recognition on.  
  if (_startRecogButton.Text == "Start Speech Recognition")   
  {       
    _startRecogButton.Text = "Stop Speech Recognition";  
    if (_useMultiple)   
    {  
      _recognitionEngine.RecognizeAsync(RecognizeMode.Multiple);  
    }   
    else   
    {  
      _recognitionEngine.RecognizeAsync(RecognizeMode.Single);  
    }  
  }  
  
  // Toggle speech recognition off.   
  else   
  {                                                        
    _startRecogButton.Text = "Start Speech Recognition";  
  
    // Stop after current phrase is finished.  
    if (_friendlyStop)   
    {       
      _recognitionEngine.RecognizeAsyncStop();   
    }  
  
    // Stop before current phrase is finished.  
    else   
    {        
      _recognitionEngine.RecognizeAsyncCancel();   
    }  
  }  
}  

注解

此枚举用作的参数RecognizeAsync(RecognizeMode)This enumeration is used as an argument to RecognizeAsync(RecognizeMode).

适用于

另请参阅