Exemplo n.º 1
0
        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;
                }
            }
        }
Exemplo n.º 2
0
        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;
                }
            }
        }