private async Task <bool> UpdatePrivacyLevelAsync(int level)
        {
            var cred = DevicePortalUtil.GetCredential();

            if (cred != null)
            {
                if (await DevicePortalUtil.SetTelemetryLevelAsync(cred.UserName, cred.Password, level))
                {
                    _previousLevel = level;
                    return(true);
                }
            }

            return(false);
        }
        private async Task <bool> UpdatePrivacyLevelAsync(int level, bool promptUser = true)
        {
            // Return false if we're not signed in and we're not allowed to prompt the user
            if (!promptUser && !await DevicePortalUtil.IsSignedInAsync())
            {
                return(false);
            }

            // Prompt the user for credentials if not logged in
            if (await LoginPopupControl.SignInAsync(Common.GetLocalizedText("PrivacySignInDescription")))
            {
                var cred = DevicePortalUtil.GetCredential();
                if (cred != null)
                {
                    if (await DevicePortalUtil.SetTelemetryLevelAsync(cred.UserName, cred.Password, level))
                    {
                        _previousLevel = level;
                        return(true);
                    }
                }
            }

            return(false);
        }