silla
silla

Reputation: 1327

System.Threading.Timer to handle async timeout?

Lets say I have a loop and Im uploading some files somewhere. If I dont have a connection I just reconnect again. If I tried to connect x times I want to wait. For this wait time I could use a Timer. But because the application is doing other stuff too, it should not be sync - I want this as async. Is it a good idea to create a System.Threading.Timer and count this down? And then I could add something like if (Timer done) { connect again and upload } Any suggestions?

Upvotes: 0

Views: 424

Answers (1)

paparazzo
paparazzo

Reputation: 45096

If the application is doing other things why is it OK to block on the uploads but not block on the wait. Do it all a BackGroundWorker and ProgressChanged to show how many files are complete.

BackgroundWorker Class

Upvotes: 1

Related Questions