private void OnDownloadProgressChangedHandler(object sender, MN.DownloadProgressChangedEventArgs e) { lock (SyncRoot) { if (e.ProgressPercentage != 0) { SetProgress(e.ProgressPercentage); } } }
private void UpdateProgress() { DownloadProgressChangedEventArgs args = null; lock (progressSync) { long totalBytesReceived = TotalBytesReceived; if (progressThisStep >= progressStep || totalBytesReceived == totalBytes && (totalBytes > 0 && progress != 100)) { progress = Convert.ToInt32 ( (totalBytesReceived * 100) / totalBytes ); if (progress >= 0) { args = new DownloadProgressChangedEventArgs ( progress, null, totalBytesReceived, totalBytes ); } progressThisStep = 0; } } if (args != null) { OnProgressChanged (args); } }
private void OnProgressChanged(DownloadProgressChangedEventArgs args) { EventHandler <DownloadProgressChangedEventArgs> handler = ProgressChanged; try { if (handler != null) { handler (this, args); } } catch {} }