Custom UI for the WPF AutomaticUpdater

Hello,

Im using the new AutomaticUpdater for the WPF version 2.6.1. I've replaced the UI completely using KeepHidden and added a functionality that is allowing the user to skip an update for now and check later.

So my logic is to always use ForceCheckForUpdate(true) when my application starts, so that the status of the update, e.g. UpdateStepOn will be updated and then display the appropriate UI messages, buttons and work according to the user's selection. If no update is available then I just skip that screen and move on. If an update is available I present 2 buttons: "Download & Install now" and "Remind me later". While pressing on "Download & Install now" calls InstallNow().

This logic usually works great, though sometimes from reason I could not 100% reproduce I have 2 issues:1. The checking for new update returns ChekingFailed and the message is: "Update did not complete the previous step..." etc..2. The UpdateStepOn says UpdateAvailable though I've already updated to the latest version.

Are these known issues? if so can you please help me?

Thanks,Jan.

Hey Jan,

You're doing a couple things wrong. Firstly, you shouldn't be checking for updates on every start. What if the user starts your app 20 times a day - will you really be releasing a new update every half hour? It's better to recheck every week.

Secondly, even if you're not using our UI, the AutomaticUpdater can (and does) handle most of the work for you. Set the "UpdateType" to "Automatic". Then you can set "DaysBetweenChecks" to something reasonable (default is 12). Also, you can use the "WaitBeforeCheckSecs" property to tell the AutomaticUpdater to only check N seconds after your app has loaded (this delayed checking gives your app a chance to start before front loading it with more tasks to do).

The checking for new update returns ChekingFailed and the message is: "Update did not complete the previous step..." etc..

Which means the AutomaticUpdater is doing something else (e.g. downloading or extracting an update) while you're trying to force a recheck. This exception is to be expected (do you really need to check for new updates while you're installing updates?).

This code might help a bit.

The UpdateStepOn says UpdateAvailable though I've already updated to the latest version.

This shouldn't happen. First fix the other problems - tell me if this still happens after you've cleaned out the unnecessary code.

Tell me if this helps.

Hello Sam,

The onlyCheck option seems to solve some of the issues, now I experience another issue. If I download and install and update, though the users cancels the update, or closes the wyUpdater process, then on the next run of my application the main window starts minimize and I've noticed the ClosingForInstall boolean is true.

How can I avoid that?

Thanks,Jan

One more question, If I terminate my application when wyUpdate downloads the new update, then when I start my app it keep getting to the UpdateProcessFailed state.

The download or extract failed event is fired and saying:Download or extract failed: wyUpdate ended before the current update step could be completed.

Then it keeps getting the UpdateProcessFailed state and doens't let me update my app, how can I reset this status?

Updating from the wyUpdater.exe worked fine.

Thanks!

The onlyCheck option seems to solve some of the issues, now I experience another issue. If I download and install and update, though the users cancels the update, or closes the wyUpdater process, then on the next run of my application the main window starts minimize and I've noticed the ClosingForInstall boolean is true.

How can I avoid that?

Calling the cancel function when wyUpdate is between steps (i.e. when it's idle) doesn't do anything. This is expected behavior.

You want to cancel an update after the update has been downloaded, extracted, and patched? That's a bit like quitting a 20-mile marathon in the last 3 yards before the finish line. In all seriousness, what are you trying to accomplish?

One more question, If I terminate my application when wyUpdate downloads the new update, then when I start my app it keep getting to the UpdateProcessFailed state.

The download or extract failed event is fired and saying:Download or extract failed: wyUpdate ended before the current update step could be completed.

Can you reproduce this on a small example project. Or can I perhaps see the code that's failing? Send it to support@wyday.com .

Dear Sam,

I did not quite succeeded to make everything works smoothly, each computer I test the updates resolves in a different bad scenario, though luanching the wyUpdater.exe works good on all of them so I guess its something wrong with the way I use the AutomaticUpdater.

--------------------------------------------The workflow I've done is:1. Luanching myapp.exe.

2. The user reaches my login window, then the WPF component of the automaticUpdater is loaded, e.g. <my:AutomaticUpdater Name="automaticUpdater" /> where "my" assembly is AutomaticUpdaterWPF.dll

After the window is loaded, using WPF "loaded" event:

3. I initialize the automaticUpdater1 object by setting: automaticUpdater.wyUpdateLocation = "wyUpdater.exe"; automaticUpdater.KeepHidden = true; automaticUpdater.UpdateType = UpdateType.OnlyCheck; automaticUpdater.DaysBetweenChecks = 1;

4. I register to all the events of the automaticUpdater.

5. I check for updates using: automaticUpdater1.ForceCheckForUpdate();

6. I'm waiting for the user to login at my application, can take a while so the automaticUpdater has time to work.

7. After my user succesfully logged in I switch over m_AutomaticUpdater.UpdateStepOn to present a UI for him:case: None, Nothing, Checking skipping to my app.All other cases presenting the progressbar status and relevant buttons: Download & Install, Skip.

8. If the user clicks on Download & Install I do: automaticUpdater.InstallNow();

--------------------------------------------

This workflow usually works fine and sadly works good most of the time from the computer I develop.But users and QA complains about instability and saying that running wyUpdater.exe usually works for them.

The last issue I have is some computers with the latest version checks for update and says there is a new version available and show release notes from a much earlier version. Luanching the wyUpdater.exe says I have the latest version, Any thoughts? 🙄

Thanks,Jan

5. I check for updates using: automaticUpdater1.ForceCheckForUpdate();

You can call this function, but why do you do this? The AutomaticUpdater automatically checks for you. This shouldn't be the cause of any problems, I'm just curious.

But users and QA complains about instability

Instability in what sense? Crashes? Can you tell me what the user expects and what's happening instead?

The last issue I have is some computers with the latest version checks for update and says there is a new version available and show release notes from a much earlier version. Luanching the wyUpdater.exe says I have the latest version, Any thoughts?

The AutomaticUpdater stores the update info in it's own cache. It does this as to not need to start wyUpdate and ask it if we're up-to-date. So when you check within your app, the AutomaticUpdater stores the update information in a cache. Then you close your app, start wyUpdate.exe, and update your app. Then you launch your app and the AutomaticUpdater still thinks you haven't updated (thus it still shows your old info).

The real problem is that you're using wyUpdate.exe in standalone mode and the AutomaticUpdater interchangeably. I think we'll be making the AutomaticUpdater a bit more aggressive at clearing the cache and rechecking stale update info. We'll be improving this in the AutomaticUpdater 2.6.7.

Can you tell me what is causing you to use wyUpdate.exe in standalone mode? If we can solve this then the experience will be better for everyone.

You can call this function, but why do you do this? The AutomaticUpdater automatically checks for you. This shouldn't be the cause of any problems, I'm just curious.

I thought it can help me reset the state of the updater, I won't call it if it's not necessary.

Instability in what sense? Crashes? Can you tell me what the user expects and what's happening instead?

1. The new version available issue, when we're up-to-date.2. Check for update always fail and we're unable to reach the UpdateAvailable event.3. An incorrect old version is downloaded instead of the newest version.

2,3 happens rarely so I prefer to solve the first issue first.

The AutomaticUpdater stores the update info in it's own cache. It does this as to not need to start wyUpdate and ask it if we're up-to-date. So when you check within your app, the AutomaticUpdater stores the update information in a cache. Then you close your app, start wyUpdate.exe, and update your app. Then you launch your app and the AutomaticUpdater still thinks you haven't updated (thus it still shows your old info).

Great, can you tell me where it stores it, so I can reset it?

Can you tell me what is causing you to use wyUpdate.exe in standalone mode? If we can solve this then the experience will be better for everyone.

What do you mean wyUpdate.exe in standalone mode? I just wan't to be able to update my software by using my own UI instead of your WPF component UI.

Much thanks for your help and efforts,

Jan

The AutomaticUpdater stores the update info in it's own cache. It does this as to not need to start wyUpdate and ask it if we're up-to-date. So when you check within your app, the AutomaticUpdater stores the update information in a cache. Then you close your app, start wyUpdate.exe, and update your app. Then you launch your app and the AutomaticUpdater still thinks you haven't updated (thus it still shows your old info).

Great, can you tell me where it stores it, so I can reset it?

Go to "%appdata%\wyUpdate AU" and delete all the files in that folder. Then go to "%userprofile%\wc" and delete all the folder in that folder. That effectively clears the cache completely.

Can you tell me what is causing you to use wyUpdate.exe in standalone mode? If we can solve this then the experience will be better for everyone.

What do you mean wyUpdate.exe in standalone mode? I just wan't to be able to update my software by using my own UI instead of your WPF component UI.

Much thanks for your help and efforts,

Jan

When you just run wyUpdate.exe (e.g. telling your user to go double click that file) you're running it in standalone mode. When you run it indirectly (by using the AutomaticUpdater control) it's running in AutomaticUpdater mode.

We'll be fixing this behavior in the next version of wyUpdate. wyUpdate will properly clear the caches and the AutomaticUpdater will recognize updating that took place outside of it's knowledge.