I have this problem: I have two Winforms, f1 and f2.
f1 will start the loop when the button is pressed, this loop checks the condition and decides to call another form, which is f2 or not.
The problem is that a loop can call f2 many times, so every time another form f2 is called the first form, f1 must pause its execution .
So, I solved it like this, I used backgroundWorker + AutoResetEvent . I put backgroundWorker in the first form and inside the DoWork event handler, which I called f2.Show (),
then I called WaitOne in AutoResetEvent, let it be A.
In another form, "f2" on the "Exit" button, I called Install on the same A.
But unfortunately, f2 freezes when you press this button in f1, what should I change?
Lisa source
share