Non-Designer AutomaticUpdater

Hi,

In my application it is possible to have multiple main forms. This is, one form per session just like the Firefox beahvior. The application is shutdown as soon as all forms are closed (Firefox like). That's why I try to decouple the AutomaticUpdater from any form and to handle the event on my own:

            AutomaticUpdater automaticUpdater = new AutomaticUpdater();            automaticUpdater.WaitBeforeCheckSecs = 1;            automaticUpdater.UpdateType = UpdateType.OnlyCheck;            automaticUpdater.UpdateAvailable += delegate(object sender, EventArgs args)            {                // handle event, e.g. MessageBox.Show("Update available: " + automaticUpdater.Changes);                //...            };

For testing purposes I've put this code in a button click event handler. But I'm not able to make it checking for updates if I don't put the control via designer onto a form. Another idea was to put it on a hidden form (I just instantiate the form) but the control doesn't seem to work on a hidden form. I also noticed that invoking ForceCheckForUpdate() without having set a ContainerForm leads to a NullReferenceException.

Is it not intended to be used like this? What are the limitations?

ThanksYves

PS. Sorry for the unformatted code but BBCode does not seem to be activated altough it's on in my profile.

As the AutomaticUpdater is written now, you need to add the AutomaticUpdater at design time. This is for simplicity reasons (the AutomaticUpdater needs to know about your main window).

The reason the AutomaticUpdater on your hidden form is because there's a bug in Windows Forms. Namely, OnLoad() isn't called when the form is started hidden. And because the AutomaticUpdate uses the OnLoad event (among other properties of the Window) the checking never starts.

That being said, the AutomaticUpdater is open source (LGPL). We haven't officially announced it, but you can check out the latest code:

svn checkout http://automatic-updater.googlecode.com/svn/trunk/ automatic-updater-read-only

We do plan on completely separating the "backend" and the "frontend" of the automatic updater. We just haven't done it yet.

PS. Sorry for the unformatted code but BBCode does not seem to be activated altough it's on in my profile.

I turned off BBCode for all users because spammers were posting porn pictures & links. Once I did this, spam dropped significantly. Unfortunately phpbb doesn't have proper bayesian spam filtering - if it did we could enable BBCode and kill spammers all in one go. We're working on replacing this crummy forum software with something lighter, faster, with real spam filtering.