I am referring to the article:
[
Calendar.NET]
This is my code
public viewCalendar(String firstIntake, String nextIntake, String lastIntake, String days, String medName, String dosageCount)
{
InitializeComponent();
calendar1.CalendarDate = DateTime.Now;
calendar1.CalendarView = CalendarViews.Month;
lblHiddenDays.Text = days;
var takeMed1 = new CustomEvent
{
Date = DateTime.Parse(firstIntake),
EventText = "Take " + dosageCount + " of " + medName,
EventFont = new Font("Verdana", 8, FontStyle.Regular),
EventColor = Color.LightBlue,
EventTextColor = Color.Black,
Rank = 1,
ThisDayForwardOnly= true,
RecurringFrequency = RecurringFrequencies.EveryTueThurs
};
var takeMed2 = new CustomEvent
{
Date = DateTime.Parse(nextIntake),
EventText = "Take " + dosageCount + " of " + medName,
EventFont = new Font("Verdana", 8, FontStyle.Regular),
EventColor = Color.LightGoldenrodYellow,
EventTextColor = Color.Black,
Rank = 2,
ThisDayForwardOnly = true,
RecurringFrequency = RecurringFrequencies.EveryTueThurs
};
var takeMed3 = new CustomEvent
{
Date = DateTime.Parse(lastIntake),
EventText = "Take " + dosageCount + " of " + medName,
EventFont = new Font("Verdana", 8, FontStyle.Regular),
EventColor = Color.LightPink,
EventTextColor = Color.Black,
Rank = 3,
ThisDayForwardOnly = true,
RecurringFrequency = RecurringFrequencies.EveryTueThurs
};
calendar1.AddEvent(takeMed1);
calendar1.AddEvent(takeMed2);
calendar1.AddEvent(takeMed3);
}
The calendar creates a schedule on when i should take the medicine.
It is first passed in from another form.
So for instance, my firstIntake is 10AM, nextIntake is 4pm and lastIntake is 10pm
I have no problem displaying that with the code above.
However, I passed in "days" from my previous form and that variable stores the number of days these events has to span across. Let's say "days" = 7
The takeMed1 event will be at 9/21/2012, 10AM
The takeMed2 event will be at 9/21/2012, 4PM
the takeMed3 event will be at 9/21/2012, 10PM
So if "days" = 7, each event will span from 9/21/2012 to 9/28/2012
I have no idea how to do this for the recurring function. Anyone help?