Somewhere in the code, a waitHandle is used to perfom some actions. However the thing with waithandle is that the form freezes while waiting for some action to complete. So the following code would not work:
frmProgressBar.show();
int successOrFail = PerformSynchronousActionUsingWaitHandle();
frmProgressBar.close();
frmMainScreen.show();
It won't work, since the frmProgressBar would be frozen instead. I really need to keep line #1, line #3 and line #4, but how do I rewrite PerformSynchronousActionUsingWaitHandle() such that the operation is still synchronous but the progress bar is displayed. I may be able to get around this by showing the progress bar on a different thread, but the design of the system is such that this would be very messy.