示例#1
0
        public static async Task VerifyAsync()
        {
            string info    = null;
            var    succeed = false;
            var    result  = await UserConsentVerifier.RequestVerificationAsync(Strings.Resources.Verify.Dialog.Content);

            switch (result)
            {
            case UserConsentVerificationResult.Verified:
                succeed = true;
                break;

            case UserConsentVerificationResult.DeviceNotPresent:
                info = Strings.Resources.Verify.DeviceNotPresent;
                break;

            case UserConsentVerificationResult.NotConfiguredForUser:
                info = Strings.Resources.Verify.NotConfigured;
                break;

            case UserConsentVerificationResult.DisabledByPolicy:
                info = Strings.Resources.Verify.Disabled;
                break;

            case UserConsentVerificationResult.DeviceBusy:
                info = Strings.Resources.Verify.DeviceBusy;
                break;

            case UserConsentVerificationResult.RetriesExhausted:
                info = Strings.Resources.Verify.RetriesExhausted;
                break;

            case UserConsentVerificationResult.Canceled:
                info = Strings.Resources.Verify.Canceled;
                break;

            default:
                info = Strings.Resources.Verify.OtherFailure;
                break;
            }
            if (!succeed)
            {
                if (info != null)
                {
                    await Notificator.GetForCurrentView().NotifyAsync(new Services.ContentDialogNotificationData
                    {
                        Title           = Strings.Resources.Verify.FailedDialogTitle,
                        Content         = info,
                        CloseButtonText = Strings.Resources.General.Exit,
                    });
                }
                Application.Current.Exit();
            }
        }