Пример #1
0
 private void configureCheckForUpdatesTask()
 {
     if (settings.AutomaticallyCheckForUpdates) {
         if (TaskManager.GetSchedule("checkForUpdates") == null) {
             TaskManager.AddTask(
                 () => {
                     try {
                         GitHubApplicationUpdater applicationUpdater = new GitHubApplicationUpdater(Program.UpdaterUrl);
                         var applicationUpdateInfo = applicationUpdater.Check();
                         if (applicationUpdateInfo.IsNewVersionAvailable(AssemblyUtils.GetVersion())) {
                             this.notifyIcon.ShowBalloonTip(10000, "uRADMonitorX Update Available", String.Format("A new version of uRADMonitorX ({0}) is available.", applicationUpdateInfo.Version), ToolTipIcon.Info);
                         }
                     }
                     catch {
                         // Silently ignore all errors when automatically checking for updates.
                         // There's no need to annoy users with these.
                     }
                 },
                 (task) => task.WithName("checkForUpdates").ToRunOnceAt(DateTime.Now.AddMinutes(2)).AndEvery(Program.UpdaterInterval).Minutes()
             );
         }
     }
     else {
         TaskManager.RemoveTask("checkForUpdates");
     }
 }
 public void Check(String updaterUrl)
 {
     IHttpApplicationUpdater applicationUpdater = new GitHubApplicationUpdater(updaterUrl);
     Assert.DoesNotThrow(() => { applicationUpdater.Check(); });
 }