|
-
Jan 11th, 2008, 12:46 PM
#1
Thread Starter
Member
[2005] 5 sec wait till event
Hi
I wondered if there is a code that does this
private function getexit()
'code thats let the app wait till the 5 sec are over
close()
end function
So the app have to close after 5 sec
can someone help me with this?
-
Jan 11th, 2008, 01:07 PM
#2
Re: [2005] 5 sec wait till event
to suspend execution for 5 seconds
vb Code:
threading.thread.sleep(5000)
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jan 11th, 2008, 01:19 PM
#3
Re: [2005] 5 sec wait till event
 Originally Posted by .paul.
to suspend execution for 5 seconds
vb Code:
threading.thread.sleep(5000)
Works great. I was kind of wondering what would be the .NET replacement for the Sleep API
vb.net Code:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Threading.Thread.Sleep(5000)
End Sub
-
Jan 11th, 2008, 02:40 PM
#4
Re: [2005] 5 sec wait till event
You could add a timer, set the interfal to 5000, then exit the program on the tick event. That would keep from shutting down the UI.
My usual boring signature: Nothing
 
-
Jan 11th, 2008, 02:41 PM
#5
Re: [2005] 5 sec wait till event
Why would anyone want to sleep the main thread for 5 full seconds?
-
Jan 11th, 2008, 03:50 PM
#6
Frenzied Member
Re: [2005] 5 sec wait till event
I was thinking the exact same thing. I don't think I've ever heard of a good reason for sleeping the UI thread before. Usually the programmer is designing something the wrong way.
Actually, after rereading the original poster's question, it seems apparent that he doesn't actually want to sleep the original thread, just to exit 5 seconds after the event is called. Because of this, I don't think sleeping or halting any threads at all, be it of the UI or worker.
The way I would do it would be to use Shaggy's solution. Sure, the Timer is only run once, but I believe it encapsulates such behavior very well.
-
Jan 11th, 2008, 05:01 PM
#7
Thread Starter
Member
Re: [2005] 5 sec wait till event
the thing is that the app i made scans files in a client folder and if the files are modyfided the app delete those files and download fresh ones from the web but the scan and replace goes so fast that users cant see the log cuz the app ends after scan event cuz the game starts then. now users got the time to read
-
Jan 11th, 2008, 05:14 PM
#8
Re: [2005] 5 sec wait till event
Why can you not just let the user click a button to have the game launched at the end instead of launching it automatically? Then the user would have as much time to read as he'd need. OR you could activate a timer with a tick of 10 seconds, instead of launching the game. When the timer has raised the tick event, launch the game.
If I where to have an application that became unresponsive for longer period of times, Id get really annoyed. If someone then told me that it is actually programmed to do so, I'd uninstall it right away.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|