UserConsentVerificationResult 列舉
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
描述驗證作業的結果。
public enum class UserConsentVerificationResult
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
enum class UserConsentVerificationResult
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public enum UserConsentVerificationResult
var value = Windows.Security.Credentials.UI.UserConsentVerificationResult.verified
Public Enum UserConsentVerificationResult
- 繼承
-
UserConsentVerificationResult
- 屬性
Windows 需求
裝置系列 |
Windows 10 (已於 10.0.10240.0 引進)
|
API contract |
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
|
欄位
Canceled | 6 | 驗證作業已取消。 |
DeviceBusy | 4 | 驗證裝置正在執行作業,而且無法使用。 |
DeviceNotPresent | 1 | 沒有可用的驗證裝置。 |
DisabledByPolicy | 3 | 組策略已停用驗證裝置驗證。 |
NotConfiguredForUser | 2 | 此使用者未設定驗證驗證器裝置。 |
RetriesExhausted | 5 | 嘗試 10 次之後,不會驗證原始驗證要求和相同驗證的所有後續嘗試。 |
Verified | 0 | 用戶已驗證。 |
範例
下列範例顯示從驗證裝置要求驗證的方法,並傳回根據UserConsentVerificationResult值描述結果的訊息。
private async System.Threading.Tasks.Task<string> RequestConsent(string userMessage)
{
string returnMessage;
// Request the logged on user's consent via authentication device.
var consentResult = await Windows.Security.Credentials.UI.UserConsentVerifier.RequestVerificationAsync(userMessage);
switch (consentResult)
{
case Windows.Security.Credentials.UI.UserConsentVerificationResult.Verified:
returnMessage = "User verified.";
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.DeviceBusy:
returnMessage = "Authentication device is busy.";
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.DeviceNotPresent:
returnMessage = "No authentication device found.";
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.DisabledByPolicy:
returnMessage = "Authentication device verification is disabled by policy.";
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.NotConfiguredForUser:
returnMessage = "Please go to Account Settings to set up PIN or other advanced authentication.";
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.RetriesExhausted:
returnMessage = "There have been too many failed attempts. Device authentication canceled.";
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.Canceled:
returnMessage = "Device authentication canceled.";
break;
default:
returnMessage = "Authentication device is currently unavailable.";
break;
}
return returnMessage;
}