private void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) { _rate.Add(e.BytesReceived); Int64 xferRate = _rate.GetRate(); String message = InstallerResources.GetString("C_C_downloadProgress"); message = String.Format(Cult.CurrentCulture, message, e.ProgressPercentage, e.BytesReceived / 1024, e.TotalBytesToReceive / 1024, xferRate); BeginInvoke(new MethodInvoker(delegate() { __progress.Value = e.ProgressPercentage; __statusLbl.Text = message; })); }
public void SetProgress(Int32 canonicalPercentage, Int64 complete, Int64 total) { if (canonicalPercentage == 0) { _calculator.Reset(total); } if (canonicalPercentage == -1) { __progress.Style = ProgressBarStyle.Marquee; return; } __progress.Style = ProgressBarStyle.Continuous; __progress.Value = canonicalPercentage; _calculator.Add(complete); }