0

I need to create an application that runs in the background throughout the day. For this, I created a console application, set the output to "Windows Application" and configured the code to run in the system tray. For the part of the application to run all day, I thought about running the application every 5 minutes and checking if there are any pending processes. If there are no processes pending for that day, the application will be on hold and will not run again until the next day.

How can I create the parts to run all day and the application only run again the next day if a condition is true? Are there any recommendations or any impediments or problems with the creation of this type of application?

Best regards for everyone.

Joao Pedro
  • 11
  • 4
  • If it is supposed to run in the background: why WinForms? You can easily do a Console App and schedule it with Windows Task Scheduler. (Amongst other possibilities, but this would be a "cheap first step" ) – Fildor Aug 20 '20 at 12:43
  • _"If there are no processes pending"_ - What are those processes exactly and how do know there will or will not be any processes "for that day"? Does that mean you want to check , let's say only from 8 AM - 6 PM and anything that comes in after 6 has to wait for tomorrow? Please explain. – Fildor Aug 20 '20 at 12:55
  • This sounds to me like you would like to create a windows service [link](https://learn.microsoft.com/en-us/dotnet/framework/windows-services/walkthrough-creating-a-windows-service-application-in-the-component-designer#create-a-service) we use Topshelf when crating services, it makes it a bit easier [link](http://topshelf-project.com/) – Tomaž Šuen Aug 20 '20 at 13:04
  • @Fildor 1) Yes, I thought of using "Windows Task Scheduler" for this with a solution close to your idea, but in this application the objective is not to use an external scheduler. Creating a "windows service" is also not an option at the moment. 2) For example: Some applications have been configured to start during the day. Application throughout the day if they have started or are pending. If all those configured for the day have been started, the application goes into standby mode until the next day, when it starts to check again that day's pending items. – Joao Pedro Aug 20 '20 at 13:30
  • Should the program also run if no one is logged on? In that case, consider to create a Win Service – Harald Coppoolse Aug 20 '20 at 15:29
  • You can try to create a Windows Service application to solve this problem. Windows Service is often used to create background running programs. These [materials](https://stackoverflow.com/questions/11027051/develop-a-program-that-runs-in-the-background-in-net) can help you. – dear_vv Aug 21 '20 at 07:09

0 Answers0