Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have a requirement what seemingly looks very simple (and perhaps strange) but some minor details are giving me troubles. Perhaps I'm overthinking this.

I'm building a scheduler application (on WPF) for an embedded device that runs everyday. The scheduler controls when the device can be turned on and off. For example, the embedded device can be scheduled to shut off every weekends and on any holidays, such as July 4th.

So I went ahead and designed my datastructure to hold a datetime collection for holidays. Firstly, I don't need to store the time but apparently in C#, there's no other appropriate class that holds just dates. Second, I also don't need to store years but then I have no way of knowing whether it is a leap year or not. (For example, I can schedule the device to be shut off on every February 29th, but that date may not be available on a particular year.)

I also need a way for the users to select a month/date. As far as I know, there's no appropriate UI control available to handle my problem. I think I need to look for something like this (Below is photoshopped from a standard calendar control):

enter image description here

What datastructure/design would you use to handle problems like this? What's a good UI design to have users intuitively select a month/date?

share|improve this question

migrated from stackoverflow.com Aug 21 '13 at 13:38

This question came from our site for professional and enthusiast programmers.

    
Your question is a little unclear as to how the normal calendar control falls short. Yes, I see that "Every 29th of February" might cause a problem, but wouldn't that only be triggered if it is in fact the 29th of February? –  Lars Kristensen Aug 21 '13 at 13:05
1  
Weekends and some holidays such as Thanksgiving vary by year. Just how did you hold a datetime collection for holidays with no year? March 1 is a Tuesday only 1/7 years. –  BalamBalam Aug 21 '13 at 13:05
    
@LarsKristensen Because a normal calendar control with a year included gives the user an impression that the scheduler only runs on that particular year/month/date when in fact it needs to run every month/date. Seems like an unintuitive UI design to me. –  l46kok Aug 21 '13 at 13:07
    
@Blam That was my impression as well (hence, why I mentioned it seemed like a strange requirement), but I was told not to necessarily link the dates user may set with actual holidays. If the user wants to only shut off the machine on every May 8th every year, he/she would be able to do so. –  l46kok Aug 21 '13 at 13:08
    
Your proposed design is also not intuitive. It presents March 1 is a Tuesday. –  BalamBalam Aug 21 '13 at 13:10
show 6 more comments

1 Answer

I'm currently trying to solve the same problem and decided to model the UI and functionality on the Outlook calendar appointments 'occurrence' feature, simplified a bit. This partially abstracts the selection of repeated events away from a calendar control and covers most scenarios. No point in reinventing the wheel.

The data model is a simple class with type of recurrence(week or month) a day of week flags enum, day of month, recurrence frequency, end date/max number of recurrences.

The tricky bit is processing the recurrence rules (work in progress).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.