C# 如何在后台代理WP7中获取电话联系人
我正在尝试每24小时将联系人同步到服务器。为此,我使用了后台代理。 当我尝试呼叫联系人时,它无法获取手机的联系人。 我的代码在这里C# 如何在后台代理WP7中获取电话联系人,c#,windows-phone-7,windows-phone-8,windows-phone,background-agents,C#,Windows Phone 7,Windows Phone 8,Windows Phone,Background Agents,我正在尝试每24小时将联系人同步到服务器。为此,我使用了后台代理。 当我尝试呼叫联系人时,它无法获取手机的联系人。 我的代码在这里 protected override void OnInvoke(ScheduledTask task) { Contacts cons = new Contacts(); //Identify the method that runs after the asynchronous search completes. cons.S
protected override void OnInvoke(ScheduledTask task)
{
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");
#if DEBUG_AGENT
ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(10));
#endif
}
void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
{
var a = e.Results;
// e.Results.Count();
NotifyComplete();
}
protected override void OnInvoke(ScheduledTask任务)
{
Contacts cons=新联系人();
//标识异步搜索完成后运行的方法。
cons.SearchCompleted+=新事件处理程序(联系人\u SearchCompleted);
//启动异步搜索。
cons.SearchAsync(String.Empty,FilterKind.None,“Contacts Test#1”);
#如果调试代理
ScheduledActionService.LaunchForTest(task.Name,TimeSpan.FromSeconds(10));
#恩迪夫
}
无效联系人搜索已完成(对象发件人、联系人搜索目标e)
{
var a=e.结果;
//e.Results.Count();
NotifyComplete();
}
是否有人能告诉我问题所在或建议更好的方法……使用此代码从
SearchAsync
函数获取结果:
List<Contact> contacts = new List<Contact>( e.Results );
List contacts=新列表(如结果);
您是否收到空列表或错误?e.result中没有名为Count的字段或任何内容。但是数据是非公开的,但我不知道如何访问结果的非公开数据