Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Windows Azure移动服务数据获取已完成_C#_Azure_Windows Phone 8_Async Await_Azure Mobile Services - Fatal编程技术网

C# Windows Azure移动服务数据获取已完成

C# Windows Azure移动服务数据获取已完成,c#,azure,windows-phone-8,async-await,azure-mobile-services,C#,Azure,Windows Phone 8,Async Await,Azure Mobile Services,我可以使用Windows Azure移动服务获取数据。我想做的是在我的应用程序中加入“加载…”。在我能做之前,我必须知道数据提取何时完成 问题是“我怎么知道这个?” 提前感谢, 一些代码 私人移动服务收集项目; 私有IMobileServiceTable itemTable=App.MobileService.GetTable(); items=wait itemtableosu.Where(todoItem=>todoItem.Complete==false); 在ToCollectionAs

我可以使用Windows Azure移动服务获取数据。我想做的是在我的应用程序中加入“加载…”。在我能做之前,我必须知道数据提取何时完成

问题是“我怎么知道这个?”

提前感谢,

一些代码
私人移动服务收集项目;
私有IMobileServiceTable itemTable=App.MobileService.GetTable();
items=wait itemtableosu.Where(todoItem=>todoItem.Complete==false);

ToCollectionAsync
之后,“returns”是在完成时。使用
wait
建立一个状态机,当该操作完成时,该状态机在UI线程上异步执行下一行。您只需执行以下操作:

items = await itemTablosu.Where(todoItem => todoItem.Complete == false).ToCollectionAsync();

myLoadingControl.Visibility = Visibility.Collapsed;

这假设
ToCollectionAsync()
是从UI线程调用的(例如,单击按钮、
加载的
处理程序、导航到
覆盖的
等)。

谢谢,它起作用了!我不知道为什么,但我本来希望找到一个“已完成”的事件方式。很抱歉我的疏忽。是的,他们已经“占用”了“异步”基于任务的模式的后缀。您可以使用从异步方法返回的
Task
执行更复杂的操作,但新模式不使用事件。
items = await itemTablosu.Where(todoItem => todoItem.Complete == false).ToCollectionAsync();

myLoadingControl.Visibility = Visibility.Collapsed;