This is the part 2 of how to build a simple feed reader following the style of the Gmail Notifier Plus which uses basically the Windows 7 taskbar features.
Part 1 was about the XAML part of the application, this part will show how to read the feeds asynchronously, how to change the ProgressBar and have an auto update features to read feeds.
First we need a prototype class to hold the feeds :
Then it initializes a WebClient object and attaching its DownloadDataCompleted and DownloadProgressChanged to 2 methods that handles the received XML asynchronously. client_DownloadProgressChanged is called when the WebClient is receiving data, client_DownloadDataCompleted is fired when the XML is ready to be parsed.
Then we call client.DownloadDataAsync(new Uri(url)); which downloads the XML asynchronously.
Then it refreshes the feeds collection by calling GetFeeds method. If the feeds load correctly then it sets the buttons to their active forms, changes the ProgressBar status to None otherwise it shows a Network error notification and changes the ProgressBar status to error to indicate a fail update.