private void AbbPreviousWeek_Click(object sender, RoutedEventArgs e) { DaysOfWeek days = viewModel.Controller.ViewDays; if (days.GetDaysOfWeek().Count() == 1) { if (days.Contains(viewModel.Settings.RefTime.DayOfWeek)) { viewModel.Settings.RefTime = viewModel.Settings.RefTime.AddDays(-7); } if (days == DaysOfWeek.Monday) { days = DaysOfWeek.Sunday; } else { days = (DaysOfWeek)((int)days >> 1); } viewModel.Controller.ViewDays = days; } else { viewModel.Settings.RefTime = viewModel.Settings.RefTime.AddDays(-7); } }