我正在尝试允许用户以这种方式从 People 应用程序中选择联系人:
private async Task<System.Collections.Generic.KeyValuePair<string, string>> SelectAContactForASlot()
{
KeyValuePair<string, string> kvp; // = new KeyValuePair<string, string>();
var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker();
contactPicker.CommitButtonText = "Select";
var contact = await contactPicker.PickSingleContactAsync();
if (contact != null)
{
kvp = new KeyValuePair<string, string>(contact.Name, contact.Emails[0].ToString());
return kvp;
}
return kvp = new KeyValuePair<string, string>("No Name found", "No email found");
}
People 应用程序确实被调用,但它看起来像这样:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~ 人v
出了点问题,此应用目前无法选择联系人。
再次尝试选择应用程序。
| Select | | Cancel |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
我昨天添加了几个联系人,所以它确实包含联系人。我的代码有问题吗,或者我该如何解决这个问题?