private void Downloader_FileDownloadProgressChanged(object?sender, FileDownloadProgress e)
        {
            lock (progressEventLock)
            {
                if (e.File.Size <= 0)
                {
                    totalBytes += e.TotalBytes;
                    e.File.Size = e.TotalBytes;
                }

                receivedBytes += e.ProgressedBytes;

                if (receivedBytes > totalBytes)
                {
                    return;
                }

                float percent = (float)receivedBytes / totalBytes * 100;
                if (percent >= 0)
                {
                    pChangeProgress?.Report(new FileProgressChangedEventArgs(totalBytes, receivedBytes, (int)percent));
                }
                else
                {
                    Debug.WriteLine($"total: {totalBytes} received: {receivedBytes} filename: {e.File.Name} filesize: {e.File.Size}");
                }
            }
        }
Example #2
0
 private void Downloader_FileDownloadProgressChanged(object?sender, FileDownloadProgress e)
 {
     pChangeProgress?.Report(new ProgressChangedEventArgs(e.ProgressPercentage, null));
 }