private void ShowClasses(Data data, GroupSettings groupSettings, DateTime date) { List <Class> classes = new List <Class>(); int currentWeekday = (int)date.DayOfWeek - 1; if (currentWeekday == -1) { currentWeekday = 6; } int currentWeek = ((date - data.Schedule.SemesterStart).Days) / 7 + 1; int currentWeekCode = 2; if (currentWeek % 2 == 1) { currentWeekCode = 1; } bool zeroClasses = true; // Clear classes classesStackPanel.Children.Clear(); ScheduleWeekday weekday = data.Schedule.GetWeekdayByNumber(currentWeekday); if (weekday != null) { emptyImage.Visibility = System.Windows.Visibility.Hidden; List <ScheduleClass> scheduleToday = weekday.Classes; for (int i = 0; i < scheduleToday.Count; i++) { if (scheduleToday[i].Week == 0 || scheduleToday[i].Week == currentWeekCode) { string setting = groupSettings.GetSettingByCode(scheduleToday[i].Code); if (setting == scheduleToday[i].Group) { ClassType type = data.Types.GetTypeById(scheduleToday[i].Type); classesStackPanel.Children.Add((new Class( data.Modules.GetModuleByCode(scheduleToday[i].Code).Name, scheduleToday[i].Location, scheduleToday[i].Hours, scheduleToday[i].Minutes, new SolidColorBrush(Color.FromRgb(type.ColorArray[0], type.ColorArray[1], type.ColorArray[2])) )).Drawable); zeroClasses = false; } } } } if (zeroClasses) { emptyImage.Visibility = System.Windows.Visibility.Visible; } else { emptyImage.Visibility = System.Windows.Visibility.Hidden; } }