protected virtual void OnDiscreteDownloadProgressChangedHandler(object sender, DiscreteDownloadProgressEventArgs args) { long bytesThisInterval = args.BytesReceivedThisInterval; DownloadInfo dif = (DownloadInfo)args.UserState; lock (dif.SyncRoot) { if (!dif.Active) { return; } } lock (syncRoot) { if (args.BytesReceived == bytesThisInterval) { BytesDownloadedPreviously(bytesThisInterval); } else { BytesDownloaded += bytesThisInterval; } } }
protected virtual void OnProgressChanged(long bytesThisInterval) { DiscreteDownloadProgressEventHandler handler = ProgressChanged; if (handler != null) { DiscreteDownloadProgressEventArgs args = new DiscreteDownloadProgressEventArgs( Convert.ToInt32(Progress), dif, bytesRead, totalLength, bytesThisInterval ); handler(this, args); } }
protected virtual void OnProgressChanged(long bytesThisInterval) { DiscreteDownloadProgressEventHandler handler = ProgressChanged; if (handler != null) { DiscreteDownloadProgressEventArgs args = new DiscreteDownloadProgressEventArgs ( Convert.ToInt32(Progress), dif, bytesRead, totalLength, bytesThisInterval ); handler (this, args); } }
protected virtual void OnDiscreteDownloadProgressChangedHandler(object sender, DiscreteDownloadProgressEventArgs args) { long bytesThisInterval = args.BytesReceivedThisInterval; DownloadInfo dif = (DownloadInfo) args.UserState; lock (dif.SyncRoot) { if (!dif.Active) { return; } } lock (syncRoot) { if (args.BytesReceived == bytesThisInterval) { BytesDownloadedPreviously (bytesThisInterval); } else { BytesDownloaded += bytesThisInterval; } } }