Example #1
0
        public void ReadProgress(int bytesRead)
        {
            if (callback == null)
            {
                return;
            }

            // Invoke the progress callback only if bytes read > 0
            if (bytesRead > 0)
            {
                totalBytesRead            += bytesRead;
                totalIncrementTransferred += bytesRead;

                if (totalIncrementTransferred >= this.progressUpdateInterval ||
                    totalBytesRead == contentLength)
                {
                    OssUtils.InvokeInBackground(
                        callback,
                        new StreamTransferProgressArgs(totalIncrementTransferred, totalBytesRead, contentLength),
                        sender);
                    totalIncrementTransferred = 0;
                }
            }
        }