예제 #1
0
 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);
 }
예제 #2
0
        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
            }
        }
예제 #3
0
 private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
 {
     ResourceDownloader.WriteToLog("Unhandled exception", e.Exception);
 }
예제 #4
0
 public static string FormatSizeDecimal(Int64 size)
 {
     return(ResourceDownloader.FormatSizeDecimal(size, default_decimals));
 }
예제 #5
0
 public static string FormatSizeBinary(long size)
 {
     return(ResourceDownloader.FormatSizeBinary(size, default_decimals));
 }