There have been updates in the client since I last blogged about the SO client. Since the first version received some attention I thought there might be people who are just interested in downloading the client instead of building one so I quickly added some features, cleaned it up and upload the binaries on http://stackoverflowclient.codeplex.com
In order to turn that sample into a working client I had to add another class called StackOverflowNotifier.
class StackOverflowNotifier
{
event EventHandler LoggedIn;
int PollInterval { get; set; }
event EventHandler QuestionsReceived;
event EventHandler RequestLogin;
void Start();
void Stop();
}
As you can see the class polls the stackoverflow active questions page periodically and downloads all the questions. The Start method, starts the timer that raises its ‘Tick’ event after regular intervals.
It was important to use the System.Windows.Forms.Timer timer because it raises the tick events on the UI thread and you can not interact with the WebBrowser control from a non UI thread.
The default polling interval is 2 minute as of now and when the questions are downloaded you are notified in system tray via a popup only if there are any questions received with ‘Interesting’ attribute set to true.
Though the latest list of questions is updated in the list view so you can click on the tray icon to view the current list of questions.
I found a very nice Tray notification control for WPF at http://www.hardcodet.net/projects/wpf-notifyicon which I used in the project. I used the FancyBaloon user control shipped in its samples and modified it so that it can be bound to a collection view so I can put the next/previous buttons and allow user to navigate through questions from the same popup instead of showing 10 different popups.
The above mentioned minor re-factoring helped clean up the code in the MainWindow. I also fixed a couple of bugs and added a trace listener that shows popup on the tray if the client barfs on exception while parsing the html.
Thats pretty much it. Go get your copy of the latest version and start answering some questions on SO
Comments
Leave a comment Trackback