private void SetOnNumOfWeeksBoxChanged() { Mediator.GetInstance().NumOfWeekBoxChanged += (numberOfWeeks, b, p) => { numOfWeeks = numberOfWeeks; if (numOfWeeks > WeekNumber) { BtnNextWeek.IsEnabled = true; } else if (numOfWeeks == WeekNumber) { BtnNextWeek.IsEnabled = false; } else if (numberOfWeeks < WeekNumber) { BtnNextWeek.IsEnabled = false; bool noShiftsWillBeLost = Shifts.TrueForAll(x => x.WeekNumber < numberOfWeeks); if (!noShiftsWillBeLost) { MessageBoxResult messageBoxResult = MessageBox.Show("Shifts placed in higher week numbers will be lost. Are you sure?", "Delete Confirmation", MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { Shifts.RemoveAll(x => x.WeekNumber > numberOfWeeks); TxtWeekNum.Text = numberOfWeeks.ToString(); WeekNumber = numberOfWeeks; BtnNextWeek.IsEnabled = false; Clear(); LoadShiftsIntoCalendar(); } else if (messageBoxResult == MessageBoxResult.No) { b.SelectedIndex = p; } } else { WeekNumber = numberOfWeeks; TxtWeekNum.Text = numberOfWeeks.ToString(); } if (numberOfWeeks == 1) { BtnPrevWeek.IsEnabled = false; } } }; }