共用方式為


RecognitionEventArgs 類別

定義

提供有關語音辨識事件的資訊。

public ref class RecognitionEventArgs abstract : EventArgs
public abstract class RecognitionEventArgs : EventArgs
[System.Serializable]
public abstract class RecognitionEventArgs : EventArgs
type RecognitionEventArgs = class
    inherit EventArgs
[<System.Serializable>]
type RecognitionEventArgs = class
    inherit EventArgs
Public MustInherit Class RecognitionEventArgs
Inherits EventArgs
繼承
RecognitionEventArgs
衍生
屬性

範例

下列範例會附加語音辨識器的 、 SpeechRecognizedSpeechRecognitionRejected 事件的處理常式 SpeechHypothesized 。 三個事件的事件引數類型全都衍生自 RecognitionEventArgs ,此引數會當做處理常式中的事件資料參數使用。

// Initialize the speech recognizer.  
private void Initialize(SpeechRecognitionEngine recognizer)  
{  
  // Attach handlers for the SpeechHypothesized, SpeechRecognitionRejected,  
  // and SpeechRecognized events.  
  recognizer.SpeechHypothesized +=  
    new EventHandler<SpeechHypothesizedEventArgs>(DisplayResult);  
  recognizer.SpeechRecognitionRejected +=  
    new EventHandler<SpeechRecognitionRejectedEventArgs>(DisplayResult);  
  recognizer.SpeechRecognized +=  
    new EventHandler<SpeechRecognizedEventArgs>(DisplayResult);  

  // Add other initialization code here.  
}  

// Handle the SpeechHypothesized, SpeechRecognitionRejected,  
// and SpeechRecognized events.  
private void DisplayResult(object sender, RecognitionEventArgs e)  
{  
  if (e is SpeechHypothesizedEventArgs)  
  {  
    Console.WriteLine("Speech hypothesized:");  
  }  
  else if (e is SpeechRecognitionRejectedEventArgs)  
  {  
    Console.WriteLine("Speech recognition rejected:");  
  }  
  else if (e is SpeechRecognizedEventArgs)  
  {  
    Console.WriteLine("Speech recognized:");  
  }  

  // Add code to handle the event.  
}  

備註

屬性 Result 會取得辨識資訊做為 RecognitionResult 物件。 如需語音辨識事件的詳細資訊,請參閱 使用語音辨識事件

RecognitionEventArgs 是下列類別的基底:

RecognitionEventArgs 衍生自 EventArgs

屬性

Result

取得與語音辨識事件關聯的辨識結果資料。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱