The BackgroundWorker class[
^] offers a method
ReportProgress[
^] that causes the
ProgressChanged[
^] event to be risen not in the working thread but in the thread that created the BackgroundWorker. Usually that is the GUI thread. You can therefore call the method in the worker thread and handle the event in the GUI thread, which can change a label without hassle.
[Edit]
Now you have to rename
new DownloadProgressChangedEventHandler(ProgressChanged)
to
new DownlaodProgressChangedEventHandler(DownloadProgressChanged)
so the method name doesn't interfere with the "other"
ProgressChanged
method.
Then implement
public void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
DownloadProgressBar.Value = e.ProgressPercentage;
}
[/Edit]