コード例 #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
ファイル: App.xaml.cs プロジェクト: wwh1004/PDB-Downloader
 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));
 }