tags:

views:

61

answers:

3
+1  Q: 

Setting a timer?

I'm uploading a file, all working fine, but I want to set a time for 60 seconds, so it waits for the file to upload before moving on.

Any ideas?

+2  A: 

I agree with @Restuta, but without knowing more info:

Thread.Sleep(60000);

Documentation here.

Abe Miessler
Thanks Abe. For the current project this will suffice. I know it's not the best method but because the bot is for personal use this will suffice. I'm using WatiN there is no event available to check if it's uploaded.
James Jeffery
A: 

This doesn't sound like the type of thing you would need a timer for unless your upload was happening on a thread?

If this is the case, as Abe Miessler says, just use Thread.Sleep(60000) on the thread you want to wait.

Otherwise, if it's all happening on one thread, your program will wait anyway, no need to make a timer, unless you wanted something where it waits up to 60 seconds and then times out if the upload wasn't successful after that much time?

In this case, you could make a timer that starts when the upload starts and stops either when the upload finishes or when sixty seconds have passed.

Brandi
A: 

Waiting for a fixed amount of time is a bad idea.

The event you want to wait for is the file upload, so find a way to wait for that.

It could take 6, 60, or 6000 seconds, you have no way to know what the right number will be.

Kevin Panko
Kevin I agree, but I am using WatiN there is no event to attach to wait for it upload. Because it's a bot I and for personal use I know that image will take no longer that 60 seconds. But to be safe I'll use 60 seconds.
James Jeffery