//clicking on a day in the calendar private void DayBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MonthDayBoxControl dayClicked = (MonthDayBoxControl)sender; CalendarDayWindow dayWindow = new CalendarDayWindow(dayClicked.getDay(), this.currentMonth, this.currentYear); dayWindow.Owner = this; dayWindow.Show(); this.Hide(); }
//clicking on a day private void DayBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MonthDayBoxControl dayClicked = (MonthDayBoxControl)sender; NewApptDay dayWindow = new NewApptDay(dayClicked.getDay(), this.currentMonth, this.currentYear, potentialLength, apptType, targetPatient); dayWindow.Owner = this; dayWindow.Show(); this.Hide(); }
//loading the month to the calendar private void loadMonthCal(int currentMonth, int currentYear) { monthText.Text = months[currentMonth - 1]; yearText.Text = currentYear.ToString(); this.uniformMonthGrid.Children.Clear(); Random rnd = new Random(); //offset for day of the week for (int i = 0; i < getDayOfWeekOffset(new DateTime(currentYear, currentMonth, 1)); i++) { MonthDayBoxControl hiddenBox = new MonthDayBoxControl(); this.uniformMonthGrid.Children.Add(hiddenBox); } //load days for (int i = 0; i < DateTime.DaysInMonth(currentYear, currentMonth); i++) //currently using 2018 as placeholder { MonthDayBoxControl dayBox = new MonthDayBoxControl(i + 1, getNumApptsForAllDoctorsByDay(currentYear, currentMonth, i + 1), "Appointment"); dayBox.MouseLeftButtonDown += DayBox_MouseLeftButtonDown; this.uniformMonthGrid.Children.Add(dayBox); } }