E
e
Short version:
myThread.Suspend() is suspending my entire application and I don't
understand why.
Long version:
I have a form that I want to pop up frequently throughout my application,
it's essentially a 'please wait' message in a fancy-graphic form. The
program can perform a number of semi-lengthy processes, so I'd like to make
it easy for me to throw up a splash on a whim. It's the only thread I'm
creating in my app.
I thought it would be an interesting learning exercise & experiment to place
this please wait splash screen into a sepereate thread, which I could
suspend & hide / resume & show at will throughout the program. And I
thought the fact that the splash is a little animated might be helped by
running it in a seperate thread. Never the less, I set up a small class
that suspends the thread & hides the form /resumes the thread & shows the
form.
The method that "shows/resumes" is smart enough to know whether or not the
thread needs to be run anew, or simply resumed by checking it's isAlive
status.
When I run the main program eventually the code comes to the first point
where it wants to show a splash screen. It calls the "show/resume" method,
which correctly figures out it needs to run the thread (as opposed to resume
the thread), the form shows up and animates while the main apps processes
work away. The main app finishes what it's doing and calls the
"hide/suspend" method. This appears to suspend both the splash screen and
the main app. I'm just using myThread.Suspend(). Why would that suspend my
entire app?
myThread.Suspend() is suspending my entire application and I don't
understand why.
Long version:
I have a form that I want to pop up frequently throughout my application,
it's essentially a 'please wait' message in a fancy-graphic form. The
program can perform a number of semi-lengthy processes, so I'd like to make
it easy for me to throw up a splash on a whim. It's the only thread I'm
creating in my app.
I thought it would be an interesting learning exercise & experiment to place
this please wait splash screen into a sepereate thread, which I could
suspend & hide / resume & show at will throughout the program. And I
thought the fact that the splash is a little animated might be helped by
running it in a seperate thread. Never the less, I set up a small class
that suspends the thread & hides the form /resumes the thread & shows the
form.
The method that "shows/resumes" is smart enough to know whether or not the
thread needs to be run anew, or simply resumed by checking it's isAlive
status.
When I run the main program eventually the code comes to the first point
where it wants to show a splash screen. It calls the "show/resume" method,
which correctly figures out it needs to run the thread (as opposed to resume
the thread), the form shows up and animates while the main apps processes
work away. The main app finishes what it's doing and calls the
"hide/suspend" method. This appears to suspend both the splash screen and
the main app. I'm just using myThread.Suspend(). Why would that suspend my
entire app?