Yes. The whole point of async and await is that you are not blocking. Instead, if you are โexpectingโ an operation that is not yet completed, a continuation is scheduled to execute the rest of the async method, and control returns to the caller.
Now, since your method is of type void , you cannot find out when it is still over - if you returned Task (which would not require any changes to the body of the method), you would at least be able to work when it is finished.
It's not entirely clear what your code looks like, but in the root you should only try to set the ItemsSource after initialization is complete. You should probably have your MainPage code in an asynchronous method that looks something like this:
Album album = new Album(2012); ListView1.ItemsSource = await album.GetSongsAsync();
Your call to GetSongs() will be as follows:
private async Task<List<Song>> GetSongsAsync() { //...some code... HttpClient cli = new HttpClient(); Stream SourceStream = await HttpClient.GetStreamAsync("http://contoso.com"); //...some code... return Parse(SourceStream); }
This means that Songs will no longer be a property of Album itself, although you can add it for caching purposes if you want.
Jon Skeet Sep 02 2018-12-12T00: 00Z
source share