Click to See Complete Forum and Search --> : Is an app with "system tray" icon OK for a continually running scheduler, or should I


callagga
September 15th, 2009, 02:20 AM
Hi,

Requirement - I have a periodic task I want to run in a windows environment for my application. It will have a simple interface that allow some basic configuration (e.g. URLs & how often to run it). I want it to run every X hours (configurable) when the machine is running.

Question - Do I just create an application with a system tray presence for this? Or should I be creating a service that has a separate UI that hooks into it.

BY THE WAY - I'm a beginner C# developing using Visual Studio Express keep in mind. Also if you could give a quick overview of the design of what you recommend that would be great for a newbie (e.g. if you suggest a service, does this mean you really need one application for the service, and another application that has a UI that does the configuration for the service?)

thanks

dannystommen
September 15th, 2009, 05:20 AM
Question - Do I just create an application with a system tray presence for this? Or should I be creating a service that has a separate UI that hooks into it.


It depends on what you want to achieve.

If the periodic task needs to tun all the time (on a server), you need to create a Windows Service. If you want this periodic task only to run when you are working on your pc, a Windows application could just do fine.

When you create a normal Windows application, it is not guaranteed that it runs. You could place it under 'startup' of Windows, but it will only start when you log in. That would mean that after a server reboot the application won't run untill you login.

A Windows Service can be configured that it always runs, even if you haven't login (for example SQL Server/MySQL)

Krishnaa
September 15th, 2009, 05:23 AM
1. You can have a Windows App Or Service and keep time check in it
Or
2. Use Task Scheduler to run the application which has only the required work coded.

callagga
September 15th, 2009, 05:44 AM
1. You can have a Windows App Or Service and keep time check in it
Or
2. Use Task Scheduler to run the application which has only the required work coded.
thanks

which of the 3 options would it be easiest to allow a simple UI to allow the user to configure the period for running the task? Like:

- re scheduled task- can a UI be used to configure this
- re app in system tray - understand this one
- re service - how would the UI interface with the service? Would need DB or common config file area shared between them?

Sounds like the simple app that minimizes to the system tray might be easiest. I assume one could configure an installation to put the app into the users startup area?

Thanks




- re sch

Arjay
September 15th, 2009, 01:30 PM
When you create a normal Windows application, it is not guaranteed that it runs. You could place it under 'startup' of Windows, but it will only start when you log in. That would mean that after a server reboot the application won't run untill you login.Another option is to add an entry to the Run key under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion.

An application placed under this key will run when the machine starts up (regardless if any user is logged on).