I have a Form A that is displayed on a thread that also contains a heartbeat monitor. When an error occurs, we need the new form, Form B to be displayed until the close button is depressed and for Form A to be non-functional until that time; however, we need Form A code to not be blocked so the heartbeat will continue to be detected. Here is what has been attempted and the problems with each:
1. Originally, Form B was brought up with .Show and was non-modal. With this method, we used FormA.Enabled = false and then back to true. This operation allows the heartbeat thread to continue and the FormA to be inactive; however, it is very slow. .466 seconds to disableand .825 seconds to enable. The enabling is very evident on Form A to the user as they try to continue.
2. Making the Form B call modal worked well, except the Form A code was halted and the heartbeat thread died taking down the entire application.
3. I then tried to start a new thread to display Form B; however, the method to display the form as two arguments and is only supported with a callback delegate (we're in .Net 1.1 - so no generics). This seemed like a big change as we are going into system test tomorrow, so I passed on this. I'm still not even certain it would have behaved modally being on a different thread than Form A and then I'd be back at using .Enabled again.
4. I tried using a timer to call the display method and learned that modal windows won't behave as modal when started from a timer on a different thread.
I believe I need to go back to method #1, but I need to find a way to speed up the .Enabled property. I read that I can put all of Form A's controls into a list to speed up the .Enabled, but there were no details of how .Enabled would know to use such a list. Does anyone have any information about how to speed up form.Enabled?