public static RecordSchedule CreateWithDefaultValues(RecordScheduleKind kind) { RecordSchedule schedule; switch (kind) { case RecordScheduleKind.RightNow: schedule = new RecordRightNow(); break; case RecordScheduleKind.OneTime: schedule = new RecordOneTime(); break; case RecordScheduleKind.Daily: schedule = new RecordDaily(); break; case RecordScheduleKind.Weekly: schedule = new RecordWeekly(); break; case RecordScheduleKind.Monthly: schedule = new RecordMonthly(); break; default: throw new IndexOutOfRangeException(); } // switch schedule.SetDefaultValues(); return(schedule); } // CreateWithDefaultValues
} // ToRecordWeekDays public override void SetDefaultValues() { base.SetDefaultValues(); RecurEveryWeeks = 1; WeekDays = RecordWeekly.ToRecordWeekDays(DateTime.Now.DayOfWeek); } // SetDefaultValues