Scheduled Windows Form Application or Console Application with GUI

Posted on 2008-11-08
Last Modified: 2013-12-17
I need to create an application that runs daily (mon-fri) as a schedule.  

I could do this as a console application but the settings for the app need to be in a friendly GUI format and there are a number of other issues that would require a GUI i.e I need to produce reports showing exceptions and processed data, also previous runs and their results in tabular form that can be sorted by clicking the header column.

You also need to be able to run a process manually if the schedule failed.

I thought of having a console application for the process and then a GUI application for the other bits.  Is there a more efficient way where all code resides in one project.


Question by:zensolutions
    LVL 8

    Expert Comment

    You could create Projects libraries, that will hold the GUI part.

    Author Comment

    Could you elaborate on how this would work and how to actually code it please?  I am new to C# .NET.
    LVL 7

    Accepted Solution

    What was mwant her is that you can create multiple projects in one solution one project for the GUI one project for the Console Application.  Diong it this way will also give you the option to cahnge the GUI to with out haveing to recode the console app.

    Have you thought of using windows services for scheduled tasks?

    Author Comment

    i read somewhere that for a task that needs to be run at a specific time daily that it is better to run as a scheduled task and not a windows service.  I felt that the windows service would be a good way of implementing the solution but then when I read that I started looking at the scheduled task method.  Do you have any ideas of how to do this in a windows service?
    LVL 7

    Expert Comment

    It is faily simple to do this in a windows service.

    You create a windows service that contains a timer that runs code every so often. then you have a config file that you use to set the time when the specific logic is suposed to be run i.e the schedule.

    In the timer elapsed event you compare the current time to the time in your config file and run the logic if the time matches the scheduled time criteria. On completion you can set a flag in the registry to indicate that the scheduled task ran correctly.  

    You logic should then contain code that checks the registry for the task completed flag as well.  If the flag was not set due to some issue then you can run it again.

    Your logic flow should be as follows

    Check if task was completed by querying the registry.
    If not compare the times
    if the current time is equal or bigger to the scheduled time then run the task
    If the task completes without errors then set the regstry flag

    it would wise to set a window in which you want the task to run.  Let say you want to run a task at 5PM then you should give it a window to run in if it does not complete the first time. Lets say the window is 2 hours.  Then the task will attempt to execute between 5PM and 7PM until it ran succesfully.

    I hop this makes sense to you.

    Author Closing Comment

    I read a bit more about the windows service and after looking through a number of fors and against decided to go with the one solution with multiple projects.  Thanks for your time.  I may be back when I get to the next stages of deveolpment with more questions.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Join & Write a Comment

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now