// see: https://msdn.microsoft.com/en-us/library/dn630427.aspx public async Task <IRecognitionResult> RecoginizeUI() { try { // Compile the dictation grammar by default. await Recognizer.CompileConstraintsAsync(); // Start recognition. SpeechRecognitionResult speechRecognitionResult = await Recognizer.RecognizeWithUIAsync(); return(new RecognitionResult(speechRecognitionResult)); } catch (Exception ex) { // handle the speech privacy policy error if ((uint)ex.HResult == HRESULT_PRIVACY_STATEMENT_DECLINED) { await SettingsLauncher.LaunchPrivacyAccountsAsync(); } else { Logger.WriteLine(ex); } } return(null); }
private async void LaunchSettingClicked(object sender, RoutedEventArgs e) { var selectedItem = SettingCommandsComboBox.SelectedItem as ComboBoxItem; if (selectedItem == null) { return; } var settingCommand = selectedItem.Content as string; switch (settingCommand) { case "LaunchPrivacyAccounts": await SettingsLauncher.LaunchPrivacyAccountsAsync(); break; case "LaunchAirplaneMode": await SettingsLauncher.LaunchAirplaneModeAsync(); break; case "LaunchBluetooth": await SettingsLauncher.LaunchBluetoothAsync(); break; case "LaunchCellular": await SettingsLauncher.LaunchCellularAsync(); break; case "LaunchEmailAccounts": await SettingsLauncher.LaunchEmailAccountsAsync(); break; case "LaunchLocation": await SettingsLauncher.LaunchLocationAsync(); break; case "LaunchLockScreen": await SettingsLauncher.LaunchLockScreenAsync(); break; case "LaunchBatterySaver": await SettingsLauncher.LaunchBatterySaverAsync(); break; case "LaunchScreenRotation": await SettingsLauncher.LaunchScreenRotationAsync(); break; case "LaunchWifi": await SettingsLauncher.LaunchWifiAsync(); break; } }