Good Async pattern for sequential WebClient requests
- by Omar Shahine
Most of the code I've written in .NET to make REST calls have been synchronous. Since Silverlight on Windows Phone only supports Async WebClient and HttpWebRequest calls, I was wondering what a good async pattern is for a Class that exposes methods that make REST calls.
For example, I have an app that needs to do the following.
Login and get token
Using token from #1, get a list of albums
Using token from #1 get a list of categories
etc
my class exposes a few methods:
Login()
GetAlbums()
GetCategories()
since each method needs to call WebClient using Async calls what I need to do is essentially block calling Login till it returns so that I can call GetAlbums().
What is a good way to go about this in my class that exposes those methods?