Automatic Updater & Launcher Support

Hello,

I've created a Launcher using C# and have inserted an Automatic Updater - when I run the Updater, it's working properly but it advises that the update will be installed on the next restart - is there a way to change the code so that the application will close and restart so that the changes take effect immediately? Any assistance you can provide would be greatly appreciated. Thanks 🙂

Yep, on the UpdateReady event, call the installNow() function. This starts the update immediately.

Thanks for getting back to me, Wyatt - how do I call the InstallNow() function? I used C# to design my launcher...do I call it from within there or is it within wyBuild itself? Is there a specific way to bring it up? Sorry - it's a code I'm unfamiliar with....

you have an AutomaticUpdater instance, let's call it automaticUpdater1. To call InstallNow(), you call:

automaticUpdater1.InstallNow();

Does that make sense?

Sure does, thanks, Wyatt - will give that a try and let you know how it goes - thanks 🙂

Okay, I'm implementing that into the code, but I have one more question if I can impose on you one more time, please - I have a start button on my launcher that I'd like users not to be able to start the application until after the updates have been completed - is there any way that I can prevent the users from bypassing them?

Well, you disable the button. Then re-enable the button if there's no update pending.

Yeah, I knew to do that but was hoping that there was some type of code that would enable me to temporarily disable it and reenable it once the updater had finished running - essentially what i'm anticipating happening is that users will see the updater pop up and will click on the "start button" and stop the updater before it's had time to complete the process (the minute the start button is clicked upon, the application loads and the updater stops)

Wyatt: I tried the code:automaticUpdater1.InstallNow(); it doesn't work - it returned an error telling me that it has to check for updates first even though the automatic updater is already in place. Any suggestions?

You're trying to use the AutomaticUpdater synchronously, when it works best asynchronously (that is, doing its work while the user actually uses your program).

If you want to force an update, then it's best to use wyUpdate.exe in standalone mode. See: How to Silently Check for Updates

There is no UpdateReady event for me to call the installNow() function. Could it be called something else by any chance? I see something that is called ReadyToBeInstalled....

Yes, sorry, you're right.

What code will be put into our Launcher that will bring up the ReadyToBeInstalled Event? We're looking at the Events, and it's asking us to use a Button - we don't want to use a button - we want it done automatically. Once we know that, we can then use the installNow() function that you recommended previously.

You want to force updates. To do that we recommend using wyUpdate in standalone mode, not the AutomaticUpdater. The AutomaticUpdater is a better choice if you want to let the users download and extract updates silently in the background when they use your program.

We really want to use the Autoupdater - it's a great tool and we love the way it works - all we really need to know is what code it would take for it to do the autoinstall - if it requires using events to do that, could you please let us know what code we need to use? We've tried unsuccessfully to put it into events using the ReadyToBeInstalled calling InstallNow(). Thanks again for all of your assistance.

You put InstallNow() in ReadyToBeInstalled event, but you also have to have an update pending for that event to ever get called. So how to you get an update pending? You check for updates and wait for the update steps to get to the point that the update is ready to be installed.

Okay, so essentially all I have to do is put the ReadyToBeInstalled.installNow(); statement and have a new patch ready for download or am I missing something else? What I'm asking is if my line of code is correct? Sorry, I was out running errands and just got back a couple of minutes ago...I've never worked with the events part of C# before so this is all new to me and I don't want to mess up my launcher and am hoping to be able to add to it as we go along - it's working great so far...I really love the ability of being able to update the application automatically.

Well, the ReadyToBeInstalled event is called "when the update is ready to be installed."

To get to that point the AutomaticUpdater has to check, download, and extract the updates.

So, yes, call InstallNow() in the ReadyToBeInstalled event.

We have successfully managed to use the installNow(); event into our Launcher and it works great! When using the Automatic Updater for the new version it is transparent - there is no progress indicator whatsoever - the updates install and the application launches immediately to the Login Screen - is there a means whereby we can add a progress bar/indicator of some sort so that the user can know that an update is being checked for or being installed?

Use the ProgressChanged event.

Thanks, Sam