I would just use boolean flags and locks.
object waitlock = new object(); bool isBackgroundWorkerCompleted = false; bool isOKButtonPressed = false; private void onPress(...) { lock(waitlock) { isOKButtonPressed = true; if (isBackgroundWorkerCompleted) DoNextStep(); else cursor.Wait();
The background thread does the same trick (just remember BeginInvoke back to the main UI thread)
Wembley
source share