Check if automaticupdate is finished

Hi

I am using wyupdate .net in my application. When the app starts there is form where the user enters username & password and logs in. I placed the automatic updater control on this form, and forcecheck for updates everytime it starts.

When the user logs in, this form closes and my main form opens.

The problem is if the user logs in before the automaticupdater is finished checking for updates, the application crashes.

Is there anyway to check if the status of the automatic updater, ie whether its finished or not, this way I could wait for it before closing the form.

P.S I need to check for updates before the user logs in because, my database on the server may have been updated and the user cannot login if there client app is out of date.

Thanks

Is there anyway to check if the status of the automatic updater, ie whether its finished or not, this way I could wait for it before closing the form.

Yes, use the UpdateStepOn property.

Tell me if this helps.

Hi

I thought this would work for me. Here is what I tried:

Private Sub BtnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOK.Click While AutomaticUpdater1.UpdateStepOn <> wyDay.Controls.UpdateStepOn.Nothing Debug.WriteLine(AutomaticUpdater1.UpdateStepOn.ToString) End While Login() End Sub

But Automatic updater always returns wyDay.Controls.UpdateStepOn.Nothing and the form closes, and I get an uncaught exeption about reference not set to an instance of an object backgroundworker. I dont get a chance to read it all because it closes down.

Is there an event that is fired when its finished checking? I f I handled uptodate,updateavailable and checkingfailed events to notify when automaticupdater has finished, would that work or is there a possibility of none of these events being fired.

Hi

Handling uptodate event to notify that the updater is finished did not work for me here is what I tried:

Private UpdaterFinished As Boolean = False

Private Sub BtnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOK.Click While UpdaterFinished = False Debug.WriteLine(AutomaticUpdater1.UpdateStepOn.ToString) End While Login() End Sub

Private Sub AutomaticUpdater1_UpToDate(sender As System.Object, e As wyDay.Controls.SuccessArgs) Handles AutomaticUpdater1.UpToDate UpdaterFinished = True End Sub

My UpdaterFinished boolean never gets updated to true and the application just gets stuck in the while loop.

You need to handle all the events. However, since you're doing a syncronous update (that is, you're forcing the user to update before they can continue to use your app) you're better off using wyUpdate in standalone mode rather than using the AutomaticUpdater. See: How to Silently Check for Updates.

The AutomaticUpdater is best when letting it run in the background. You're clearly not doing that.