//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); } }
private void DownloadChangeLogFinished(Updater.DownloadChangeLogResult result) { if (this.InvokeRequired) { Debug.WriteLine("Invoking download change log on update form."); Updater.DownloadChangeLogFinishedHandler updateFormInvoker = new Updater.DownloadChangeLogFinishedHandler(DownloadChangeLogFinished); this.Invoke(updateFormInvoker, result); } Program.updateHelper.updater.DownloadChangeLogFinished -= DownloadChangeLogFinished; if (result.Success) { //string[] lines = result.LogText.Split(("\n\r").ToCharArray(), StringSplitOptions.None); string[] lines = Regex.Split(result.LogText, @"\r?\n|\r"); richTextBoxChangeLog.Clear(); foreach (string line in lines) { if (line == "Change Log") { richTextBoxChangeLog.SelectionIndent = 0; richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold); richTextBoxChangeLog.AppendText(line + "\n"); richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 8.25f); } else { if (line.Contains("(") && line.Contains(")")) { richTextBoxChangeLog.SelectionIndent = 0; richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 10f, FontStyle.Bold); richTextBoxChangeLog.AppendText(line + "\n"); richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular); } else { richTextBoxChangeLog.SelectionIndent = 10; richTextBoxChangeLog.AppendText(line + "\n"); } } } } }
public UpdateHelper(String ApplcationDirectory, String DownloadDirectory, Version ApplcationVersion) { updater = new Updater(ApplcationDirectory, DownloadDirectory, ApplcationVersion); }
//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); } }
//Fires when an update check has finished. private void UpdateCheckReturn(Updater.UpdateCheckResult result) { if (this.InvokeRequired) { Debug.WriteLine("Invoking update check result on update form."); Updater.UpdateCheckFinishedHandler updateFormInvoker = new Updater.UpdateCheckFinishedHandler(UpdateCheckReturn); this.Invoke(updateFormInvoker, result); } Program.updateHelper.updater.UpdateCheckFinished -= UpdateCheckReturn; proBar.Style = ProgressBarStyle.Continuous; lblRemoteVer.Text = "Remote version: " + result.LatestVersion.ToString(); DownloadChangeLog(result.ChangeLogUrl); if (result.UpdateAvailable) { btnUpdate.Enabled = true; updateFileListUrl = result.UpdateFileListUrl; } }
//Fired when the update download is finished. private void DownloadUpdateReturn(Updater.DownloadUpdateResult result) { if (this.InvokeRequired) { Debug.WriteLine("Invoking download update result on update form."); Updater.DownloadUpdateFinishedHandler updateFormInvoker = new Updater.DownloadUpdateFinishedHandler(DownloadUpdateReturn); this.Invoke(updateFormInvoker, result); } Program.updateHelper.updater.DownloadUpdateFinished -= DownloadUpdateReturn; proBar.Style = ProgressBarStyle.Continuous; btnUpdate.Enabled = true; if (result.Success) { Program.updateRunFileList = result.RunFiles; Program.updateRestart = true; Program.updateLoopRunning = false; } else { MessageBox.Show(result.Message, Application.ProductName); } }