UserConsentVerifierAvailability 枚举

定义

描述身份验证设备(如指纹读取器)检查的结果。

public enum class UserConsentVerifierAvailability
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
enum class UserConsentVerifierAvailability
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public enum UserConsentVerifierAvailability
var value = Windows.Security.Credentials.UI.UserConsentVerifierAvailability.available
Public Enum UserConsentVerifierAvailability
继承
UserConsentVerifierAvailability
属性

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

字段

Available 0

身份验证设备可用。

DeviceBusy 4

身份验证设备正在执行操作,但不可用。

DeviceNotPresent 1

没有可用的身份验证设备。

DisabledByPolicy 3

组策略已禁用身份验证设备。

NotConfiguredForUser 2

未为此用户配置身份验证设备。

示例

以下示例演示一个方法,该方法检查当前用户是否支持身份验证设备,并返回一条消息,该消息基于 UserConsentVerifierAvailability 值描述结果。

public async System.Threading.Tasks.Task<string> CheckDeviceAvailability()
{
    string returnMessage;

    // Check the availability of device authentication.
    var ucvAvailability = await Windows.Security.Credentials.UI.UserConsentVerifier.CheckAvailabilityAsync();

    switch (ucvAvailability)
    {
        case Windows.Security.Credentials.UI.UserConsentVerifierAvailability.Available:
            returnMessage = "Authentication device is available.";
            break;
        case Windows.Security.Credentials.UI.UserConsentVerifierAvailability.DeviceBusy:
            returnMessage = "Authentication device is busy.";
            break;
        case Windows.Security.Credentials.UI.UserConsentVerifierAvailability.DeviceNotPresent:
            returnMessage = "No authentication device found.";
            break;
        case Windows.Security.Credentials.UI.UserConsentVerifierAvailability.DisabledByPolicy:
            returnMessage = "Authentication device verification is disabled by policy.";
            break;
        case Windows.Security.Credentials.UI.UserConsentVerifierAvailability.NotConfiguredForUser:
            returnMessage = "Please go to Account Settings to set up a PIN or other advanced authentication.";
            break;
        default:
            returnMessage = "Authentication device is currently unavailable.";
            break;
    }

    return returnMessage;
}

注解

可以使用 CheckAvailabilityAsync 方法确定当前计算机是否支持指纹身份验证。

适用于

另请参阅