简体   繁体   中英

Windows Azure Mobile Services Data Fetching Completed

I can fetch my data using Windows Azure Mobile Services. 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,

Some Code

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. Use of await builds up a state machine that executes the next line asynchronously on the UI thread when that operation is completed. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM