如何在异步方法中更新主UI的进度条。
本帖最后由 chyun7290 于 2013-11-29 16:29:20 编辑
Data.cs
public static async void SavingThread()
{
for (int i = 0; i < TotalCount; i++)
{
DuplicateContactId = SaveData.IsDuplicateContact(conlistWP,App.GlobalContactinfo.AllContacts[i]);
await SaveData.AddContacts(store1, App.GlobalContactinfo.AllContacts[i]);
App.GlobalContactinfo.AddContactCount++;
}
persent = (int)((float)(i + 1) * 100 / (float)TotalCount);
//如何在次更新进度条
}
}
MainPage.xmal.cs
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Data.SavingThread();
}