none
Automatic Handling of Events Question RRS feed

  • Question

  • In most cases events are triggered when humans click a button, enter a field, select an item in a combobox, etc.
    I'm developing an application where not a human being is the source of an event but the event is related to a datetime: automatically sending reminder emails after a certain time (eg after 1 day, 2 days, 5 days => this can be choosen in a preferences panel). I'm completely stuck as how I can achieve this. Someone can give me hints as to how i can implement this in .NET/C#?

    Thanks.
    Guy

     

    Monday, January 23, 2012 4:05 PM

Answers

  • @Reed: Thanks. I already had a look at Quartz.Net but I think it will be overkill. Do you know Quartz.Net? I think I'll go the Windows Task Scheduler way.

    Thanks.
    Guy

    Quartz.net would work - you could just use a standard System.Threading.Timer if you want, as well - 

     

    However, Task Scheduler is really nice - it gives you a huge amount of control, and I'd argue is really the "best" approach for this type of scenario.


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Marked as answer by Guy Dillen Monday, January 23, 2012 7:40 PM
    Monday, January 23, 2012 6:12 PM

All replies

  • I'd recommend looking at using the Windows Task Scheduler.  It allows you to schedule "tasks" (which can be a simple console application) and reconfigure them at runtime - so they run on any schedule you wish.

     

    Otherwise, you can build a service that uses timers - but I prefer the task scheduler approach as it's easier to adjust in deployment.


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Monday, January 23, 2012 4:35 PM
  • @Reed: Thanks. I already had a look at Quartz.Net but I think it will be overkill. Do you know Quartz.Net? I think I'll go the Windows Task Scheduler way.

    Thanks.
    Guy

    Monday, January 23, 2012 5:40 PM
  • @Reed: Thanks. I already had a look at Quartz.Net but I think it will be overkill. Do you know Quartz.Net? I think I'll go the Windows Task Scheduler way.

    Thanks.
    Guy

    Quartz.net would work - you could just use a standard System.Threading.Timer if you want, as well - 

     

    However, Task Scheduler is really nice - it gives you a huge amount of control, and I'd argue is really the "best" approach for this type of scenario.


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Marked as answer by Guy Dillen Monday, January 23, 2012 7:40 PM
    Monday, January 23, 2012 6:12 PM
  • Ok tahnks. As will take the Task Scheduler approach. I suppose sufficient info is available on the Net?

    Thanks.

    Guy

     

    Monday, January 23, 2012 7:41 PM
  • Ok tahnks. As will take the Task Scheduler approach. I suppose sufficient info is available on the Net?

    Thanks.

    Guy

     

    Yeah - the some samples to use are here:  http://support.microsoft.com/kb/308569

     

    If you want to script the setup of the scheduler, see examples here: http://msdn.microsoft.com/en-us/library/aa384006(v=vs.85).aspx


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Monday, January 23, 2012 7:47 PM
  • Since I'm developing in C# can I use the C# TaskScheduler class as well?

    thanks.

    Guy

     

    Monday, January 23, 2012 9:05 PM
  • Since I'm developing in C# can I use the C# TaskScheduler class as well?

    thanks.

    Guy

     

    That's a completely unrelated thing - The TaskScheduler is part of the Task Parallel Library - it has nothing to do with scheduling tasks to run at specific times or intervals. 
    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Monday, January 23, 2012 9:43 PM
  • Ok thanks. Well i'll first have a look at Task Scheduler and come back here if something isn't clear to me.

    Thanks.

     

    Monday, January 23, 2012 10:03 PM