public void Load() { Classes.Clear(); foreach (ClassViewModel _class in MainViewModel.Instance.Parameters.Classes) { EntryClassViewModel entryClass = new EntryClassViewModel() { Class = _class }; foreach (StudentViewModel student in _class.Students) { EntryStudentViewModel entryStudent = new EntryStudentViewModel() { Student = student }; entryClass.Students.Add(entryStudent); } Classes.Add(entryClass); } SelectedClass = Classes.FirstOrDefault(); if (SelectedClass != null) { SelectedClass.SelectedStudent = SelectedClass.Students.FirstOrDefault(); } }
public void Load() { Classes.Clear(); if (SelectedTeacher != null) { foreach (ClassViewModel _class in MainViewModel.Instance.Parameters.Classes.Where(c => c.Teachers.Contains(SelectedTeacher))) { EntryClassViewModel entryClass = new EntryClassViewModel() { Class = _class }; foreach (StudentViewModel student in _class.Students) { EntryStudentViewModel entryStudent = new EntryStudentViewModel() { Student = student }; entryStudent.LoadEntryTrimesterSubjectComments(SelectedTeacher); entryClass.Students.Add(entryStudent); } Classes.Add(entryClass); } SelectedClass = Classes.FirstOrDefault(); if (SelectedClass != null) { SelectedClass.SelectedStudent = SelectedClass.Students.FirstOrDefault(); if (SelectedClass.SelectedStudent != null) { SelectedClass.SelectedStudent.SelectedTrimesterSubjectCommentsSubject = SelectedClass.SelectedStudent.TrimesterSubjectCommentsSubjects.FirstOrDefault(); } } } }
private static void SelectedTrimesterSubjectCommentsSubjectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { EntryStudentViewModel entryStudent = (EntryStudentViewModel)d; entryStudent.SelectedSubjectChangedEvent?.Invoke(); }