I have integrated this into my app's "Start Up Form". It does not work as I would expect (so I assume I am doing something wrong).Essentially I first check for updates: AutomaticUpdaterBackend auBackend = new AutomaticUpdaterBackend(); auBackend.Initialize(); // All actions are manual auBackend.UpdateType = UpdateType.OnlyCheck; //Event Handler for updates available auBackend.UpdateAvailable += new EventHandler(auBackend_UpdateAvailable); // Event handler is no updates required auBackend.UpToDate += new SuccessHandler(auBackend_UpToDate); // Event handler for failed check auBackend.CheckingFailed += new FailHandler(auBackend_CheckingFailed); updateStatus = UpdateStatus.checking; // UpdateStatus is an enum If (auBackend.ForceCheckForUpdate()) while(true) { switch (updateStats) {// Everything fine to here, UpdateAvailable envent is triggered, and the UpdateStatus gets changed appropriatly case UpdateStatus.UpdateAvailable: // Upon a dialog and show user what changes are available ans see if they want to proceed if ( Proceed) { auBackend.UpdateType = UpdateType.CheckAndDownload; auBackend.ReadyToBeInstalled += new EventHandler(auBackend_ReadyToBeInstalled); auBackend.ProgressChanged += new UpdateProgressChanged(auBackend_ProgressChanged); auBackend.ForceCheckForUpdate();// At this point, no events are triggered (at least the ones I have handled above) and it loops forever while (!ureadtToInstall) { if (updateStatus != 0) { //Update Progress } } auBackend.InstallNow(); } break;
As the initial call to ForceCheckForUpdate() came back with a UpdateAvailable, I would have thought that the second call (with UpdateType = CheckAndDownload) would eventually trigger the ReadyToBeInstalled event Which is does not.
I also tried setting = new AutomaticUpdaterBackend(); and auBackend.Initialize(); after the proceed if just in case.
Where am I going wrong?
Neal