public UpdateDownloadForm(Release release) { InitializeComponent(); Icon = Icon.FromHandle(Resources.Update.GetHicon()); Text = release.Name; changeLog.SetChangelog(release.Changelog); downloadProgress.DisplayStyle = TextProgressBar.ProgressBarDisplayText.Both; downloadProgress.CustomText = release.Asset.name; _releaseFile = new WebFile(new Uri(release.Asset.browser_download_url)); _releaseFile.DownloadProgressChanged += (sender, args) => { downloadProgress.Invoke(new Action(() => { downloadProgress.Value = args.ProgressPercentage; })); }; _releaseFile.DownloadFailed += (sender, @event) => { AppLogger.Log.Error("Couldn't download the Release ", @event.Exception); MessageBox.Show(@event.Exception.Message, UpdateFormStrings.downloadFailed, MessageBoxButtons.OK, MessageBoxIcon.Error); }; _releaseFile.Downloaded += (sender, args) => { installButton.Invoke(new Action(() => { installButton.Enabled = true; downloadProgress.Enabled = false; })); }; _releaseFile.DownloadFile(); }
public void Update(Release release, bool closeApp) { using (AppLogger.Log.InfoCall()) { var file = new WebFile(new Uri(release.Asset.browser_download_url), InstallerFilePath); file.Downloaded += (sender, args) => { AppLogger.Log.Info("Update downloaded: " + file); file.Start(InstallerParameters); if (closeApp) { _context.Send(s => { Application.Exit(); }, null); } }; file.DownloadFile(); } }
public void Update(Release release, bool closeApp) { var file = new WebFile(new Uri(release.Asset.browser_download_url), InstallerFilePath); file.Downloaded += (sender, args) => { Log.Information("Update downloaded: {@File}", file); if (!SignatureChecker.IsValid(file.FilePath)) { Log.Error("The file has the wrong signature. Update cancelled."); return; } file.Start(InstallerParameters); if (closeApp) { _context.Send(s => { Application.Exit(); }, null); } }; file.DownloadFile(); }