Articles   |   Downloads   |   .NET   |   About   |   Contact


Back To


JPEG Saver Source Code

The JPEG Saver source code can be downloaded here.  Here are a few notes about the code:
Things I like:
I'm pleased with the ImageInfo, BaseResource and BitmapCompressor classes.  The BaseResource class was my chance to learn the finer details of IDisposable, and the class contains numerous comments that I wrote along the way.
The NUnit tests for those classes were very helpful when refactoring the code.
I like the overall design of the app.  I was aiming for a good balance between features and ease of use, and I'm pleased with the result. The only real drawback is that the GUI displays a few too many dialog boxes in some circumstances.
Things that could be improved (if I had the time):
In hindsight, my decision to use data binding for the list of files was not a good one.  The lack of a PositionChanging event on BindingManagerBase resulted in some ugly "work around" code, so it probably would have been better not to use data binding at all.  It would be interesting to see if .NET 2 allows a better implementation, without the ugly work around.
One of the NUnit tests fails in some circumstances (but strangely, never on my home PC).  I've since found the bug - which is in the test, not the app itself - but have not yet got round to uploading a corrected version of the test.
The main form has too much code in it.  In particular, the event handlers to support scrolling the image (by dragging it) should be factored out into some kind of "scrollable image control" class.

Page History: Created 9 Aug 04, updated 4 Dec 05
                                                                                                                                                                                                                                                                                                           
Copyright (c) 2003-2006, John Rusk.