public MeetingAgenda Next() { DateTime date = start.AddDays(gen.Next(dateRange)); MeetingAgenda meetingAgenda = new MeetingAgenda(); meetingAgenda.DateInfo = date; string eveningMeeting = EveningMeetingDescription[gen.Next(0, EveningMeetingDescription.Count - 1)].Description; string eveningMeetingTimeInfo = EveningMeetingDescription[gen.Next(0, EveningMeetingDescription.Count - 1)].TimeInfo; return(new MeetingAgenda(eveningMeeting, eveningMeetingTimeInfo, date)); }
/// <summary> /// Event for Load /// </summary> private void Form1_Load(object sender, EventArgs e) { this.sfCalendar1.SelectionChanged += SfCalendar1_SelectionChanged; this.sfCalendar1.DrawCell += SfCalendar1_DrawCell1; this.sfCalendar1.HighlightTodayCell = false; RandomMeetingInfo morInfo; RandomMeetingInfo morInfo1; EveRandomMeetingInfo eveInfo; for (int i = 0; i <= 6; i++) { morInfo = new RandomMeetingInfo(new DateTime(DateTime.Now.Year, DateTime.Now.AddMonths(i).Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.AddMonths(i).Month, 28)); morInfo1 = new RandomMeetingInfo(new DateTime(DateTime.Now.Year, DateTime.Now.AddMonths(i).Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.AddMonths(i).Month, 28)); eveInfo = new EveRandomMeetingInfo(new DateTime(DateTime.Now.Year, DateTime.Now.AddMonths(i).Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.AddMonths(i).Month, 28)); for (int j = 0; j < 8; j++) { MeetingAgenda mornmeetingInfo = morInfo.Next(); MeetingAgenda mornmeetingInfo1 = morInfo1.Next(); MeetingAgenda evemeetingInfo = eveInfo.Next(); List <AppointmentTimeRange> ranges = new List <AppointmentTimeRange>(); AppointmentTimeRange morningRange = new AppointmentTimeRange(mornmeetingInfo.MorningDescription, mornmeetingInfo.MorningTimeInformation, RandColor()); AppointmentTimeRange morningRange1 = new AppointmentTimeRange(mornmeetingInfo1.MorningDescription, mornmeetingInfo1.MorningTimeInformation, RandColor()); AppointmentTimeRange eveningRange = new AppointmentTimeRange(evemeetingInfo.EveningDescription, evemeetingInfo.EveningTimeInformation, RandColor()); ranges.Add(morningRange); if (j % 17 == 0) { ranges.Add(morningRange1); ranges.Add(eveningRange); } else if (j % 2 == 0) { ranges.Add(eveningRange); } Appointment apt = new Appointment(ranges, mornmeetingInfo.DateInfo); this.Appointment.Add(apt); } } this.sfCalendar1.Style.Cell.CellFont = new Font("Segoe UI", this.sfCalendar1.Style.Cell.CellFont.Size + 2); this.sfCalendar1.Style.Cell.TrailingCellFont = new Font("Segoe UI", this.sfCalendar1.Style.Cell.CellFont.Size + 2); this.sfCalendar1.Style.Cell.SelectedCellFont = new Font("Segoe UI", this.sfCalendar1.Style.Cell.CellFont.Size + 2); this.sfCalendar1.SelectedDate = this.Appointment[0].Date; SfSkinManager.SetVisualStyle(this, "Office2019Colorful"); }