P
Paul
Hi,
I have a Windows Forms client that calls a web service both synchronously
and asynchronously. If a certain value is returned, I pop up a MessageBox
to the user, and wait for their answer. I set a timer before the window
opens to make sure something happens within a time period. If the timer
does in fact pop, I call this.Close() on the form to close the app.
When the timer pops after a synchronous call to the web service, the close
causes the MessageBox to close, and the Application terminates. But if the
call to the web service is async, a call to this.Close() in the timer
elapsed function closes the form, but the MessageBox remains open (and
subsequently, the app remains resident).
Sync:
------
Call Web Service Sync
Examine result
Set Timer
Open Message Box
Timer Pops
this.Close()
MessageBox Closes, and Application Sucessfully Exits
Async:
-------
Call Begin_Web Service (async)
Async Callback Called
Delegate function invoked
Examine result
Set Timer
Open MessageBox
Timer Pops
this.Close()
Form closes, but MessageBox remains open until user intervention, leaving
the app running.
....
Does anyone have an explanation and method to get the message box to close
(and the app to exit) in the Async case?
Thanks,
-Paul
I have a Windows Forms client that calls a web service both synchronously
and asynchronously. If a certain value is returned, I pop up a MessageBox
to the user, and wait for their answer. I set a timer before the window
opens to make sure something happens within a time period. If the timer
does in fact pop, I call this.Close() on the form to close the app.
When the timer pops after a synchronous call to the web service, the close
causes the MessageBox to close, and the Application terminates. But if the
call to the web service is async, a call to this.Close() in the timer
elapsed function closes the form, but the MessageBox remains open (and
subsequently, the app remains resident).
Sync:
------
Call Web Service Sync
Examine result
Set Timer
Open Message Box
Timer Pops
this.Close()
MessageBox Closes, and Application Sucessfully Exits
Async:
-------
Call Begin_Web Service (async)
Async Callback Called
Delegate function invoked
Examine result
Set Timer
Open MessageBox
Timer Pops
this.Close()
Form closes, but MessageBox remains open until user intervention, leaving
the app running.
....
Does anyone have an explanation and method to get the message box to close
(and the app to exit) in the Async case?
Thanks,
-Paul