[英]Windows Phone add phone contacts to a list
I would like to memorize all the phone's contacts to a list that I create that I will work with later, I need a loop that will go from the first to the last contact, which will put the number and name into a list. 我想将手机的所有联系人记住到我创建的列表中,以后再使用。我需要一个循环,该循环将从第一个联系人到最后一个联系人,然后将电话号码和姓名放入列表中。 Haven't got a clue how to do that loop, don't know where it starts, how to loop trough or where it ends.
尚不知道如何执行该循环,不知道它从何处开始,如何使波谷或结束于何处。
Here is a good example how to access the contact list. 这是一个如何访问联系人列表的好例子。
How to access contact data for Windows Phone - MSDN 如何访问Windows Phone的联系人数据-MSDN
Basically you create a new Contacts
object and subscribe to the SearchCompleted
Event and then start a search. 基本上,您将创建一个新的
Contacts
对象并订阅SearchCompleted
事件,然后开始搜索。 SearchAsync(String.Empty, FilterKind.None, "State String 1")
searches for all phone contacts. SearchAsync(String.Empty, FilterKind.None, "State String 1")
搜索所有电话联系人。
Code Sample from link: 来自链接的代码示例:
{
Contacts cons = new Contacts();
//Identify the method that runs after the asynchronous search completes.
cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted);
//Start the asynchronous search.
cons.SearchAsync(String.Empty, FilterKind.None, "Contacts Test #1");
}
void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
{
//Do something with the results.
MessageBox.Show(e.Results.Count().ToString());
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.