[英]Windows Azure Mobile Services Data Fetching Completed
I can fetch my data using Windows Azure Mobile Services. 我可以使用Windows Azure移动服务获取数据。 What I want to do is to put a "Loading..." into my app.
我想做的是在我的应用程序中放入“正在加载...”。 Before I can do it, I must know when the data fetching is completed.
在执行此操作之前,我必须知道何时完成数据提取。
The question is "How do I know this?" 问题是“我怎么知道?”
Thanks in advance, 提前致谢,
private MobileServiceCollection<TodoItem, TodoItem> items;
private IMobileServiceTable<TodoItem> itemTable = App.MobileService.GetTable<TodoItem>();
items = await itemTablosu.Where(todoItem => todoItem.Complete == false).ToCollectionAsync();
After the ToCollectionAsync
"returns" is when it's done. ToCollectionAsync
之后,“返回”是完成的时间。 Use of await
builds up a state machine that executes the next line asynchronously on the UI thread when that operation is completed. 使用
await
会建立一个状态机,该状态机将在完成该操作后在UI线程上异步执行下一行。 You should only need to do something like: 您只需要执行以下操作:
items = await itemTablosu.Where(todoItem => todoItem.Complete == false).ToCollectionAsync();
myLoadingControl.Visibility = Visibility.Collapsed;
This assumes that ToCollectionAsync()
is called from the UI thread (eg a button click, a Loaded
handler, an OnNavigatedTo
override, etc. 假定从UI线程调用
ToCollectionAsync()
(例如,单击按钮, Loaded
处理程序, OnNavigatedTo
重写等)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.