private void SetupCortana() { var isCortanaSupported = CortanaSettings.IsSupported(); cortanaConsentRequestedFromSwitch = false; // Only allow the Cortana settings to be enabled if Cortana is available on this device CortanaVoiceActivationSwitch.IsEnabled = isCortanaSupported; CortanaAboutMeButton.IsEnabled = isCortanaSupported; // If Cortana is supported on this device and the user has never granted voice consent, // then set a flag so that each time this page is activated we will poll for // Cortana's Global Consent Value and update the UI if needed. if (isCortanaSupported) { var cortanaSettings = CortanaSettings.GetDefault(); needsCortanaConsent = !cortanaSettings.HasUserConsentToVoiceActivation; // If consent isn't needed, then update the voice activation switch to reflect its current system state. if (!needsCortanaConsent) { CortanaVoiceActivationSwitch.IsOn = cortanaSettings.IsVoiceActivationEnabled; } } }
public static Task <bool> LaunchCortanaToConsentPageAsyncIfNeeded() { var isCortanaSupported = false; try { isCortanaSupported = CortanaSettings.IsSupported(); } catch (UnauthorizedAccessException) { // This is indicitive of EmbeddedMode not being enabled (i.e. // running IotCoreDefaultApp on Desktop or Mobile without // enabling EmbeddedMode) // https://developer.microsoft.com/en-us/windows/iot/docs/embeddedmode } // Do nothing for devices that do not support Cortana if (isCortanaSupported) { // Ordinarily, this is run during a first use Out-of-box-Experience (OOBE) and voice consent will NOT be granted. // So, we launch Cortana to it's Consent Page as part of OOBE to give the end-user an opportunity to give consent. // However on development systems where the IotCoreDefaultApp may be deployed repeatedly after Cortana consent has // already been granted we will bypass the Cortana Launch. var cortanaSettings = CortanaSettings.GetDefault(); if (!cortanaSettings.HasUserConsentToVoiceActivation) { return(LaunchCortanaToConsentPageAsync()); } } return(Task.FromResult <bool>(false)); }
public static void LaunchCortanaToConsentPageAsyncIfNeeded() { // Do nothing for devices that do not support Cortana if (CortanaSettings.IsSupported()) { // Ordinarily, this is run during a first use Out-of-box-Experience (OOBE) and voice consent will NOT be granted. // So, we launch Cortana to it's Consent Page as part of OOBE to give the end-user an opportunity to give consent. // However on development systems where the IotCoreDefaultApp may be deployed repeatedly after Cortana consent has // already been granted we will bypass the Cortana Launch. var cortanaSettings = CortanaSettings.GetDefault(); if (!cortanaSettings.HasUserConsentToVoiceActivation) { LaunchCortanaToConsentPageAsync(); } } }
public static bool IsCortanaSupported() { var isCortanaSupported = false; try { isCortanaSupported = CortanaSettings.IsSupported(); } catch (UnauthorizedAccessException) { // This is indicitive of EmbeddedMode not being enabled (i.e. // running IotCoreDefaultApp on Desktop or Mobile without // enabling EmbeddedMode) // https://developer.microsoft.com/en-us/windows/iot/docs/embeddedmode } return(isCortanaSupported); }
private void SetupCortana() { var isCortanaSupported = false; try { isCortanaSupported = CortanaSettings.IsSupported(); } catch (UnauthorizedAccessException) { // This is indicitive of EmbeddedMode not being enabled (i.e. // running IotCoreDefaultApp on Desktop or Mobile without // enabling EmbeddedMode) // https://developer.microsoft.com/en-us/windows/iot/docs/embeddedmode } cortanaConsentRequestedFromSwitch = false; // Only allow the Cortana settings to be enabled if Cortana is available on this device CortanaVoiceActivationSwitch.IsEnabled = isCortanaSupported; CortanaAboutMeButton.IsEnabled = isCortanaSupported; // If Cortana is supported on this device and the user has never granted voice consent, // then set a flag so that each time this page is activated we will poll for // Cortana's Global Consent Value and update the UI if needed. if (isCortanaSupported) { var cortanaSettings = CortanaSettings.GetDefault(); needsCortanaConsent = !cortanaSettings.HasUserConsentToVoiceActivation; // If consent isn't needed, then update the voice activation switch to reflect its current system state. if (!needsCortanaConsent) { CortanaVoiceActivationSwitch.IsOn = cortanaSettings.IsVoiceActivationEnabled; } } }