C # recurring event (e.g. for calendar)

I am trying to design support for recurring events (for example, you would see it in Outlook or task manager, etc.). I did a lot of digging on Google and StackOverflow, but not very lucky.

I wonder if anyone has pointers or resources.

'Requirements'

  • Support for daily events (occurs on Monday, Tue, Thu at 10 a.m. or every 15 minutes).
  • Monthly events

Anything else is a bonus, but that will be minimal.

Thanks!

+3
source share
5 answers

What I used for this is the built-in TaskScheduler. There is an easy-to-use shell here: http://taskscheduler.codeplex.com/

If you haven’t already done so, search for the task planner in the Start menu and play with it. This shell essentially allows you to programmatically do your best with a graphical interface.

+1
source
+2
source

The answer Bob gave for this question is pretty good. He based his decision on the work of the SQL Server team on sysschedules.

http://technet.microsoft.com/en-us/library/ms178644.aspx .

+2
source

Check the iCal Wiki and iCal RFC (especially the Duration and Repeat Rule sections). I think this will give you a good starting point on how to present such events.

Excerpt from RFC:

... For example "the last work day of the month" could be represented as: FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1 
+1
source

If the problem you are trying to solve is that you can only respond to such events when your program is running, this is true. The most practical solution to this problem is to run the program in the background, most often using the notification icon on the taskbar.

If the problem is that you do not know how to track such events, you can either use the existing infrastructure (see graphic answer), set timers (research System.Threading.Timer), or periodically compare DateTime.Now with various DateTime objects . In the latter case, you will need to serialize DateTime objects to save them to disk between sessions.

-1
source

Source: https://habr.com/ru/post/1433050/


All Articles