Как инициализировать HResult в приложениях XAML?
Эта статья быстрого запуска распознавания речи дает мне указание
... инициализировать глобальную переменную (HResultPrivacyStatementDeclined) со значением HResult 0x80045509
Коды:
private static uint HResultPrivacyStatementDeclined = 0x80045509;
а также
catch (Exception exception)
{
// Handle the speech privacy policy error.
if ((uint)exception.HResult == HResultPrivacyStatementDeclined)
{
resultTextBlock.Visibility = Visibility.Visible;
resultTextBlock.Text = "The privacy statement was declined.
Go to Settings -> Privacy -> Speech, inking and typing, and ensure you
have viewed the privacy policy, and 'Get To Know You' is enabled.";
// Open the privacy/speech, inking, and typing settings page.
await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-accounts"));
}
else
{
var messageDialog = new Windows.UI.Popups.MessageDialog(exception.Message, "Exception");
await messageDialog.ShowAsync();
}
}
Но где мы должны разместить эти коды? В App.xaml.cs?