I am wanting to create a Windows Service for the first time, but just have a question about the logic of it:
I want to create a service that every x seconds, poll's a directory, reads all the text files in this directory, inserts the details into the database and then archives this file.
How do I do this so that it runs every x seconds? (which x is defined in a configuration file).
Do I do a loop that says something like:
int interval = 5000;
while (TRUE) {
//my logic
Thread.Sleep(interval); //pause for 5 seconds
}
Is this the accepted method to achieve this?