Hey guys,
So far your solution has worked well for me, but recently updating has become temperamental. I'm using AutomaticUpdaterBackend, to launch the updates and sometimes wyUpdate updates properly, sometimes it fails silently. I haven't noticed a pattern to when it does or doesn't fail, but it almost always works fine when the debugger is running, breakpoints or no.
Here's some code:
private static AutomaticUpdaterBackend _auBack = null;
public static AutomaticUpdaterBackend AutomaticUpdaterBackend { get { return _auBack ?? (_auBack = new AutomaticUpdaterBackend { GUID = "my_guid_here", UpdateType = UpdateType.Automatic }); } }
[STAThread] public static void Main(string[] args) { bool failure = false; ManualResetEvent allowContinue = new ManualResetEvent(false); AutomaticUpdaterBackend.BeforeDownloading += delegate(object sender, BeforeArgs e) { if (failure) { e.Cancel = true; return; } Log.Info(Properties.Resources.UPDATE_AVAILABLE); }; AutomaticUpdaterBackend.ReadyToBeInstalled += delegate { if (AutomaticUpdaterBackend.UpdateStepOn == UpdateStepOn.UpdateReadyToInstall) { if (!failure) AutomaticUpdaterBackend.InstallNow(); } }; AutomaticUpdaterBackend.UpToDate += delegate(object sender, SuccessArgs e) { allowContinue.Set(); };
FailHandler failHandler = delegate(object sender, FailArgs e) { failure = true; if (e.ErrorMessage != null) { Log.Error(e.ErrorMessage); } allowContinue.Set(); }; AutomaticUpdaterBackend.CheckingFailed += failHandler; AutomaticUpdaterBackend.DownloadingFailed += failHandler; AutomaticUpdaterBackend.ExtractingFailed += failHandler; AutomaticUpdaterBackend.UpdateFailed += failHandler;
AutomaticUpdaterBackend.Initialize(); AutomaticUpdaterBackend.AppLoaded();
if (!AutomaticUpdaterBackend.ClosingForInstall && AutomaticUpdaterBackend.UpdateStepOn == UpdateStepOn.Nothing) { AutomaticUpdaterBackend.ForceCheckForUpdate(); }
allowContinue.WaitOne(); }
Sorry for the format, I couldn't get BBCode on.