I think you can use the BackgroundWorker to perform such long time operation as uploading. And the BackgroundWorker has an ability to report progress.
... int progress = (int) ((float)uploaded / (float)fileSize * 100); bw.ReportProgress(progress); ...
and here is event handler: private void bckgrndWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { this.myProgressBar.Value = e.ProgressPercentage; } |