RecognizerInfo.Id Propriedade

Definição

Obtém o identificador de uma instância de SpeechRecognizer ou SpeechRecognitionEngine.Gets the identifier of a SpeechRecognizer or SpeechRecognitionEngine instance.

public:
 property System::String ^ Id { System::String ^ get(); };
public string Id { get; }
member this.Id : string
Public ReadOnly Property Id As String

Valor da propriedade

String

Retorna o identificador de uma SpeechRecognizer instância ou específica SpeechRecognitionEngine .Returns the identifier for a specific SpeechRecognizer or SpeechRecognitionEngine instance.

Exemplos

O exemplo a seguir implementa um clique de botão que exibe todas as informações em uma RecognizerInfo instância.The following example implements a button click that displays all the information in a RecognizerInfo instance. O exemplo usa a Id propriedade para obter a cadeia de caracteres do identificador de uma configuração do mecanismo de reconhecimento e, em seguida, a exibe em um MessageBox .The example uses the Id property to obtain the identifier string of a recognition engine configuration, and then displays it in a MessageBox.

private void recognizerInfoButton_Click(object sender, EventArgs e)   
{  
  RecognizerInfo info = _recognizer.RecognizerInfo;  
  string AudioFormats = "";  
  foreach (SpeechAudioFormatInfo fmt in info.SupportedAudioFormats)   
  {  
    AudioFormats += String.Format("       {0}\n",  fmt.EncodingFormat.ToString());  
  }  
  string AdditionalInfo = "";  
  foreach (string key in info.AdditionalInfo.Keys)   
  {  
    AdditionalInfo += String.Format("      {0}: {1}\n", key, info.AdditionalInfo[key]);  
  }  
  MessageBox.Show(String.Format(  
                           "Name:                 {0 }\n" +  
                           "Description:          {1} \n" +  
                           "SupportedAudioFormats:\n" +  
                           "{2} " +  
                           "Culture:              {3} \n" +  
                           "AdditionalInfo:       \n" +  
                           " {4}\n",  
                           info.Name.ToString(),  
                           info.Description.ToString(),  
                           AudioFormats,  
                           info.Culture.ToString(),  
                           AdditionalInfo));  
}  

Comentários

O identificador retornado pela Id propriedade é o mesmo que o nome do token do mecanismo de reconhecimento no registro do Windows.The identifier returned by the Id property is the same as the token name of the recognition engine in the Windows registry.

Aplica-se a

Confira também