I want a thread to put up a messagedialog before it embarks on a lengthy bit of work. Equally, I want this to run unattended so that after some period such as 20 secs, a timer “clicks” the OK button and the thread continues.
Is there a cross-platform way to do the timer part?
I think the only (best) way to do that is a custom dialog box where you can control the close method directly
I just did what Dave suggested and it worked out great! Mine was for PDF creation. When the user clicks a button to create the PDF, I show the Dialog with an infinite progress bar, create the PDF, close the Dialog, then show the PDF. I’m used to thinking and working synchronously, but this concept is asynchronous.
- Create a Dialog with an IsRunning and IsDone boolean properties both defaulted to No.
- Add a Button to the Dialog that sets IsRunning to true, disables the Button, and starts your process on Clicked.
- Add a 20 sec Single Timer to the Dialog that sets isRunning to true, disables the Button, and starts your process if IsRunning is False
- Add a 1 sec Multiple Timer to close the Dialog when IsDone is True.
- When the process is done, set IsDone to True.
Looks like I’ll have to roll my own then, thx.