RecognitionEventArgs Třída

Definice

Poskytuje informace o událostech rozpoznávání řeči.

public ref class RecognitionEventArgs abstract : EventArgs
[System.Serializable]
public abstract class RecognitionEventArgs : EventArgs
public abstract class RecognitionEventArgs : EventArgs
[<System.Serializable>]
type RecognitionEventArgs = class
    inherit EventArgs
type RecognitionEventArgs = class
    inherit EventArgs
Public MustInherit Class RecognitionEventArgs
Inherits EventArgs
Dědičnost
RecognitionEventArgs
Odvozené
Atributy

Příklady

Následující příklad připojí obslužnou rutinu SpeechHypothesizedpro události , SpeechRecognizeda SpeechRecognitionRejected rozpoznávání řeči. Typy argumentů událostí pro tyto tři události jsou odvozeny od RecognitionEventArgs, který se používá jako parametr dat události v obslužné rutině.

// 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.  
}  

Poznámky

Vlastnost Result získá informace o rozpoznávání jako RecognitionResult objekt. Další informace o událostech rozpoznávání řeči najdete v tématu Použití událostí rozpoznávání řeči.

RecognitionEventArgs je základem pro následující třídy:

RecognitionEventArgs je odvozeno od EventArgs.

Vlastnosti

Result

Získá data výsledku rozpoznávání přidružená k události rozpoznávání řeči.

Metody

Equals(Object)

Určí, zda se zadaný objekt rovná aktuálnímu objektu.

(Zděděno od Object)
GetHashCode()

Slouží jako výchozí hashovací funkce.

(Zděděno od Object)
GetType()

Získá aktuální Type instanci.

(Zděděno od Object)
MemberwiseClone()

Vytvoří mělkou kopii aktuálního Objectsouboru .

(Zděděno od Object)
ToString()

Vrátí řetězec, který představuje aktuální objekt.

(Zděděno od Object)

Platí pro

Viz také