private void downloader_FileDownloadStarted(object sender, EventArgs e) { lblStatus.Content = String.Format("Downloading {0}", downloader.CurrentFile.Path); lblFileSize.Content = String.Format("File size: {0}", ResourceDownloader.FormatSizeBinary(downloader.CurrentFileSize)); //lblFileSize.Content = String.Format("sdfsdfs"); //lblSavingTo.Content = String.Format("Saving to {0}\\{1}", downloader.LocalDirectory, downloader.CurrentFile.Name); }
private void downloader_ProgressChanged(object sender, EventArgs e) { try { pBarFileProgress.Value = downloader.CurrentFilePercentage(); lblFileProgress.Content = String.Format("Downloaded {0} of {1} ({2}%)", ResourceDownloader.FormatSizeBinary(downloader.CurrentFileProgress), ResourceDownloader.FormatSizeBinary(downloader.CurrentFileSize), downloader.CurrentFilePercentage()) + String.Format(" - {0}/s", ResourceDownloader.FormatSizeBinary(downloader.DownloadSpeed)); if (downloader.SupportsProgress) { pBarTotalProgress.Value = downloader.TotalPercentage(); lblTotalProgress.Content = String.Format("Downloaded {0} of {1} ({2}%)", ResourceDownloader.FormatSizeBinary(downloader.TotalProgress), ResourceDownloader.FormatSizeBinary(downloader.TotalSize), downloader.TotalPercentage()); } } catch (Exception ex) { //eat it, not cool I know } }
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { ResourceDownloader.WriteToLog("Unhandled exception", e.Exception); }
public static string FormatSizeDecimal(Int64 size) { return(ResourceDownloader.FormatSizeDecimal(size, default_decimals)); }
public static string FormatSizeBinary(long size) { return(ResourceDownloader.FormatSizeBinary(size, default_decimals)); }