//Fired when the update download is finished. private void DownloadUpdateReturn(Updater.DownloadUpdateResult result) { updater.DownloadUpdateFinished -= DownloadUpdateReturn; if (result.Success) { Program.updateRunFileList = result.RunFiles; Program.updateRestart = true; Program.updateLoopRunning = false; } else { IconManager.ShowBalloonPopup(Application.ProductName, result.Message, ToolTipIcon.Info); } }
//Fires when an update check has finished. private void UpdateCheckReturn(Updater.UpdateCheckResult result) { updater.UpdateCheckFinished -= UpdateCheckReturn; if (!result.UpdateAvailable) { return; } if (Globals.AutoUpdate) { IconManager.ShowBalloonPopup(Application.ProductName, "Downloading update: " + result.LatestVersion.ToString(), ToolTipIcon.Info); DownloadUpdate(result.UpdateFileListUrl); } else { IconManager.ShowBalloonPopup(Application.ProductName, "Update available: " + result.LatestVersion.ToString(), ToolTipIcon.Info); } }
//Checks if we need to check for updates. public void CheckForUpdatesIfNeeded() { if (afterUpdate) { IconManager.ShowBalloonPopup(Application.ProductName, "Successfully updated to version " + Application.ProductVersion + ".", ToolTipIcon.Info); afterUpdate = false; if (Common.GetRunningOnStartup()) { Common.SetRunningOnStartup(false); Common.SetRunningOnStartup(true); } } if (Globals.UpdateCheckTime == 0) { return; } if (_lastUpdateCheckTick + Globals.UpdateCheckTime < Environment.TickCount) { UpdateCheck(); } }