private void thread_downloadComplete(object sender, AsyncCompletedEventArgs e) { if (this.btn_downloadUpdate.InvokeRequired) { threadDelegate_download d = new threadDelegate_download(thread_downloadComplete); this.Invoke(d, sender, e); } else { this.btn_downloadUpdate.Text = "Re-Download"; this.btn_downloadUpdate.Enabled = true; this.lbl_downloadProgress.Text = ""; this.btn_cancelDownload.Visible = false; this.progress_download.Value = 0; this.timer_downloadSpeed.Enabled = false; if (e.Cancelled) { System.IO.File.Delete(appPath + @"\chrome-win32-" + this.latest_build + "-" + this.timestamp + ".zip"); } else { this.lbl_lastDownloaded.Text = this.latest_build; saveLastDownloaded(this.latest_build); if (backup_enabled) { string[] files = Directory.GetFiles(appPath, "*.zip"); int deleteUpTo = files.Length - backup_copies; for (int x = 0; x < deleteUpTo; x++) { System.IO.File.Delete(files[x]); Console.WriteLine("deleting file: " + files[x]); } } } } }
private void thread_downloadComplete(object sender, AsyncCompletedEventArgs e) { if (this.btn_downloadUpdate.InvokeRequired) { threadDelegate_download d = new threadDelegate_download(thread_downloadComplete); this.Invoke(d, sender, e); } else { this.btn_downloadUpdate.Text = "Re-Download"; this.btn_downloadUpdate.Enabled = true; this.lbl_downloadProgress.Text = ""; this.btn_cancelDownload.Visible = false; this.progress_download.Value = 0; this.timer_downloadSpeed.Enabled = false; if (e.Cancelled) System.IO.File.Delete(appPath + @"\chrome-win32-" + this.latest_build + "-" + this.timestamp + ".zip"); else { this.lbl_lastDownloaded.Text = this.latest_build; saveLastDownloaded(this.latest_build); if (backup_enabled) { string[] files = Directory.GetFiles(appPath, "*.zip"); int deleteUpTo = files.Length - backup_copies; for (int x = 0; x < deleteUpTo; x++) { System.IO.File.Delete(files[x]); Console.WriteLine("deleting file: " + files[x]); } } } } }