当按钮被点击时,我能否编写一个代码块来打开Windows Hello窗口,并根据密码的正确性采取行动?如果可以编写,我该如何做呢?
我正在使用:Windows Forms .NET Framework(C#)
当按钮被点击时,我能否编写一个代码块来打开Windows Hello窗口,并根据密码的正确性采取行动?如果可以编写,我该如何做呢?
我正在使用:Windows Forms .NET Framework(C#)
Microsoft.Windows.SDK.Contracts
package. In the right pane of the NuGet Package Manager window select the desired version of the package based on the version of Windows 10 you want to target and click install.Microsoft.NETCore.UniversalWindowsPlatform
package and install it.// Required using statements:
// using Windows.Security.Credentials;
private async void button1_Click(object sender, EventArgs e)
{
bool supported = await KeyCredentialManager.IsSupportedAsync();
if (supported)
{
KeyCredentialRetrievalResult result =
await KeyCredentialManager.RequestCreateAsync("login",
KeyCredentialCreationOption.ReplaceExisting);
if (result.Status == KeyCredentialStatus.Success)
{
MessageBox.Show("Logged in.");
}
else
{
MessageBox.Show("Login failed.");
}
}
}
以下是结果:
要了解更多信息,请参阅以下文档:
Microsoft.Windows.SDK.Contracts
包。更多详细信息请参见此处。我的另一个答案显示表情符号面板和使用MediaCapture api也采用了相同的方法。 - Reza Aghaei