I created a windows service project. And if you create a new project you get something like this:
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new Service1()
};
ServiceBase.Run(ServicesToRun);
And now I have to add some functions and timer to my class Service1()
and then everything is fine.
Now let say, my service should do some stuff like: reading some files, deleting some folders, checking connections...
And all of them should run async. What is now better? Copy all of the functiont in Service1() and not changing anything else or to create for every "stuff" a new class (Service1(), Service2(), ...) and add them like
ServicesToRun = new ServiceBase[]
{
new Service1(),
new Service2() //not sure this will compile
};
Just asking. Maybe I did not understand 100% how services are working...