void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) { long bytesIn = e.BytesReceived; long totalBytes = e.TotalBytesToReceive; int percentage = e.ProgressPercentage; //MessageBox.Show(e.BytesReceived.ToString(), "Bytes Rx'd"); UpdateInstallLabel("Downloading ClamAV - " + percentage.ToString() + "%"); DownloadProgressBar.Value = percentage; // Set the LED to Gray if ((percentage & 2) == 0) { ClamAVInstallLabel.Image = CommonImages.GrayIcon; } else { ClamAVInstallLabel.Image = CommonImages.GreenIcon; } ClamAVInstallLabel.Refresh(); }
private void UpdateProgress(int BytesRead, int TotalBytes) { // Calculate the download progress in percentages Int32 PercentProgress = Convert.ToInt32((BytesRead * 100) / TotalBytes); // Make progress on the progress bar DownloadProgressBar.Value = BytesRead; // Display the current progress on the form UpdateInstallLabel("Downloading ClamAV - " + BytesRead.ToString() + " (" + PercentProgress + "%) "); // Set the LED to Gray if ((PercentProgress & 2) == 0) { ClamAVInstallLabel.Image = CommonImages.GrayIcon; } else { ClamAVInstallLabel.Image = CommonImages.GreenIcon; } ClamAVInstallLabel.Refresh(); }