wpf 异步使用

方法前加 asyc,同步方法掉异步方法

public void Init()

{

   buildUI();

}

 

// await 只能用在异步方法上面

public async void buildUI()
{
// buildUIAsync();
AppService appserv = new AppService();
TileList.Items.Clear();
List<AppModel> applst = await appserv.getappList(Convert.ToInt32(mainwin.UserDic["uid"]));

if(applst != null)
{
foreach (AppModel appm in applst)
{
AddTile(appm);
}

// 复制到本地App列表
localApps = new List<AppModel>(applst.ToArray());
}
}

posted @ 2014-04-10 10:49  youhumian  阅读(813)  评论(0编辑  收藏  举报