private void DebugCheckNewVersion() { var culture = Thread.CurrentThread.CurrentUICulture; var notifyer = new RemoteService().NewVersionNotifyer(); notifyer.Checked += (sender, e) => { this.Logger.DebugFormat("Found new version. Current version: {0} - Remote version {1}", e.RemoteVersion, PluginContext.Configuration.Version); new UserInteraction(culture).NotifyNewVersion(e.RemoteVersion); }; this.Logger.DebugFormat("Check if there's a newer version. Current is {0}", PluginContext.Configuration.Version); notifyer.Check(PluginContext.Configuration.Version); }
/// <summary> /// Checks the new version. This action is delayed of 5 seconds. /// </summary> public void CheckNewVersion() { var timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(5); timer.Tick += (sender, e) => { try { Logger.Debug("Checking new versions..."); timer.Stop(); var culture = Thread.CurrentThread.CurrentUICulture; var versionNotifyer = new RemoteService().NewVersionNotifyer(); versionNotifyer.Checked += (sender1, e1) => { if (PluginContext.DbConfiguration.NotifyOnNewVersion) { new UserInteraction(culture) .NotifyNewVersion(e1.RemoteVersion); } }; versionNotifyer.Check(PluginContext.Configuration.Version); } catch (Exception ex) { //I swallow because I don't want to see the application crash because of the version check this.Logger.Warn("The version check crashed", ex); } }; timer.Start(); }