我在app.xml.cs的OnLaunched方法中有以下代码,但对话框根本没有显示,有人可以建议:
CredentialPickerOptions credPickerOptions = new CredentialPickerOptions();
credPickerOptions.Message = Message.Text;
credPickerOptions.Caption = Caption.Text;
credPickerOptions.TargetName = Target.Text;
credPickerOptions.AlwaysDisplayDialog = (AlwaysShowDialog.IsChecked == true);
CredentialPickerOptions options = new CredentialPickerOptions()
{
AuthenticationProtocol = AuthenticationProtocol.Basic,
CredentialSaveOption = Windows.Security.Credentials.UI.CredentialSaveOption.Selected,
CallerSavesCredential = true,
Caption = "Basic Login",
Message = "Please enter your credentials",
TargetName = "."
};
CredentialPickerResults results = await CredentialPicker.PickAsync(options);
答案 0 :(得分:1)
credentialPicker不会全屏打开,而是在页面顶部打开,因此您需要在打开第一页后打开它。如果您无法在凭证选择器之前打开应用程序的主页面,则可以创建一个包含启动画面图像的页面。