private void downloadBWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { object[] data = e.UserState as object[]; switch ((string)data[0]) { case "downloading": { FileDownloadingEventArgs downloadInfo = data[1] as FileDownloadingEventArgs; if (DownloadUpdate != null) { DownloadUpdate(this, downloadInfo); } } break; case "done": { FileDownloadingEventArgs downloadInfo = data[1] as FileDownloadingEventArgs; if (DownloadComplete != null) { DownloadComplete(this, downloadInfo); } } break; case "error": { Exception ex = data[1] as Exception; if (ex != null) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } } break; } }
static void FileDownloadingEventHandler(object sender, FileDownloadingEventArgs e) { Console.WriteLine("{0}, Image #{1}:", e.SearchString, e.ImageNumber); Console.WriteLine("Downloading from"); Console.WriteLine(" {0}", e.SourceUrl); Console.WriteLine(" to"); Console.WriteLine(" {0}...", e.FileName); Console.WriteLine(); }
void Download_DownloadUpdate(object sender, FileDownloadingEventArgs e) { pgbDownloadProgress.Value = e.Percent; //UpdateStatus("Downloading: " + PMDCP.Core.IO.Files.GetFileSize(e.Position) + "/" + PMDCP.Core.IO.Files.GetFileSize(e.FileSize) + " (" + e.Percent + "%)"); }
void Download_DownloadComplete(object sender, FileDownloadingEventArgs e) { pgbDownloadProgress.Hide(); lblStatus.Show(); UpdateStatus("Installing..."); }