bright, fresh software

AutomaticUpdater control in your .NET App

The AutomaticUpdater control is included with wyBuild 2.5 and it can be included with your applications royalty free. It works with Visual Studio 2005 & Visual Studio 2008.

First, get wyBuild

You need wyBuild to use the AutomaticUpdater control, so download wyBuild now. You can use it free for 21-days with no restrictions. And if you don't like it you can uninstall it - no hard feelings & no files laying around.

Add the AutomaticUpdater control to Visual Studio Toolbox

You need to add the AutomaticUpdater control to your Visual Studio Toolbox. Do this by right clicking the Toolbox, selecting "Choose Items...", and browsing for the AutomaticUpdater.dll.

Adding AutomaticUpdater control to Visual Studio Toolbox

AutomaticUpdater.dll is located in the wyBuild installation folder. Usually:

C:\Program Files\wyBuild\AutomaticUpdater\AutomaticUpdater.dll
	or
C:\Program Files (x86)\wyBuild\AutomaticUpdater\AutomaticUpdater.dll

Drag the AutomaticUpdater control to your .NET app

Now drag the AutomaticUpdater control to your main form.

Adding AutomaticUpdater control to a form

Finishing touches

Add a "Check for updates" menu to your form:

Adding menu to your form

Then associate the menu item with the AutomaticUpdater control. Also generate a GUID (Globally Unique ID) for the AutomaticUpdater control by clicking the ellipsis button.

AutomaticUpdater properties

Lastly, you can change the way the AutomaticUpdater control animates to show more information by setting the Anchor property on the control:

Anchor property

If you set the Anchor property to be "Top, Left" the AutomaticUpdater control will animate rightwards, and if you set the Anchor property to "Top, Right" the control will animates leftwards:

Anchor property

Useful Properties & Events

The AutomaticUpdater has quite a few useful events and properties. In particular, the "ClosingForInstall" property and the "ClosingAborted" event are especially useful.

The AutomaticUpdater install updates on 2 conditions. Either the user specifically click "Install updates now" or your application starts and there are updates ready to be installed. In this 2nd case the AutomaticUpdater control sets its "ClosingForInstall" property to "true".

Here's an example of using the "ClosingForInstall" property in the Form's constructor:

C#:
public Form1()
{
    InitializeComponent();

    // only load files, etc. when NOT closing to install an update
    if (!automaticUpdater.ClosingForInstall)
    {
        // load important files, etc.
        // LoadFilesEtc();
    }
}
VB.NET:
Public Sub New()
    InitializeComponent()

    ' only load files, etc. when NOT closing to install an update
    If Not automaticUpdater.ClosingForInstall Then
        ' load important files, etc.
        ' LoadFilesEtc()
    End If
End Sub

However, if the update isn't ready to install (because it was corrupted, deleted, or otherwise), the closing of your application will be aborted and the "ClosingAborted" event will be called. You can use this event to load files that you previously skipped in the constructor:

C#:
private void automaticUpdater_ClosingAborted(object sender, EventArgs e)
{
    // your app was preparing to close
    // however the update wasn't ready so your app is going to show itself
    // LoadFilesEtc();
}
VB.NET:
Private Sub automaticUpdater_ClosingAborted(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles automaticUpdater.ClosingAborted
    ' your app was preparing to close
    ' however the update wasn't ready so your app is going to show itself
    ' LoadFilesEtc()
End Sub