May 2019
Intermediate to advanced
504 pages
11h 50m
English
In the retrieve example, we executed the view-model data assignment block within a BeginInvokeOnMainThread block. While this actually guaranteed that the view-model change will be propagated to the UI thread, with this type of an execution, we cannot really say that once the asynchronous method that's awaiting the execution is complete, and that the view-model has been updated. Moreover, the UI execution block could have used another asynchronous code block (for example, to show a popup once the data is retrieved). In this type of a situation, we can utilize a task completion source so that we have more stricter control over when the asynchronous code block is truly completed:
public async Task RetrieveUserProfile() { // Removed ...Read now
Unlock full access