SpeechRecognizerUx.SpeechRecognizerUx() constructor
Bing
The SpeechRecognizerUx() constructor initializes a new instance of the SpeechRecognizerUx class.
In most cases, you should create the SpeechRecognizerUx directly in markup, as shown in the syntax section. However, if you wish to dynamically add the control, you can do so by creating the control in code and then adding it to an existing container on the page.
Example
The following code example creates a SpeechRecognizer instance, creates a SpeechRecognizerUx, binds them together, and adds the control to a UI container element named SpeechHostPanel.
using Microsoft.Bing.Speech; using Microsoft.Bing.Speech.Xaml; ... public MainPage() { this.InitializeComponent(); this.Loaded += MainPage_Loaded; } SpeechRecognizer SR; private void MainPage_Loaded(object sender, RoutedEventArgs e) { // Apply credentials from the Windows Azure Data Marketplace. var credentials = new SpeechAuthorizationParameters(); credentials.ClientId = "<YOUR CLIENT ID>"; credentials.ClientSecret = "<YOUR CLIENT SECRET>"; // Initialize the speech recognizer. SR = new SpeechRecognizer("en-US", credentials); // Create a SpeechRecognizerUx control and bind it to // the speech recognizer. var SpeechControl = new.SpeechRecognizerUx(); SpeechControl.SpeechRecognizer = SR; // Add the control to the page. SpeechHostPanel.Children.Add(SpeechControl); }
Requirements
Minimum Supported Client | Windows 8 |
Required Extensions | Bing.Speech |
Namespace |
Show:
Javascript developers dynamically adding the SpeechRecognizerUx control to a page must call the WinJS.UI.process function on the control before binding it to the SpeechRecognizer.