Fixed a glaring bug in the ProgressReporter which could throw exceptions into the ProgressChanged event handler (race condition between dialog setup and first progress message)

git-svn-id: file:///srv/devel/repo-conversion/nuwi@21 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2008-06-18 19:20:25 +00:00
parent 6ab7e999ad
commit 1063c4f0f2

View File

@ -104,6 +104,11 @@ namespace Nuclex.Windows.Forms {
this.abortReceiver = (progression as IAbortable); this.abortReceiver = (progression as IAbortable);
this.cancelButton.Enabled = (this.abortReceiver != null); this.cancelButton.Enabled = (this.abortReceiver != null);
// Make sure the progress bar control has been created (otherwise, we've got
// a chance that BeginInvoke() would fail if the first progress notification
// arrived before we called ShowDialog()!)
IntPtr tempDummy = this.progressBar.Handle;
// Subscribe the form to the progression it is supposed to monitor // Subscribe the form to the progression it is supposed to monitor
progression.AsyncEnded += this.asyncEndedDelegate; progression.AsyncEnded += this.asyncEndedDelegate;
IProgressReporter progressReporter = progression as IProgressReporter; IProgressReporter progressReporter = progression as IProgressReporter;