.net - Make a c# application that runs continuously -


i writing client side app pushes data users computers website. want application update website every 60ish seconds. right have function wrapped in infinite while loop 45 second sleep. but, windows says application not responding though updating website. here how code structured.

your problem while loop blocking ui thread. fix this, need run code on separate thread.

the easiest way start off.. might use timer:

system.timers.timer timer = new system.timers.timer(45000); // timer execute every 45 seconds  timer.elapsed += (sender, e) => {     // upload code here };  timer.start(); 

you should threading @ later stage though. perhaps backgroundworker or task parallel library.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -