Reputation: 23
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,
private MobileServiceCollection<TodoItem, TodoItem> items;
private IMobileServiceTable<TodoItem> itemTable = App.MobileService.GetTable<TodoItem>();
items = await itemTablosu.Where(todoItem => todoItem.Complete == false).ToCollectionAsync();
Upvotes: 2
Views: 163
Reputation: 35881
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 (e.g. a button click, a Loaded
handler, an OnNavigatedTo
override, etc.
Upvotes: 1