private XElement GetDayToXml(Day day) { var dayXml = new XElement(Day); dayXml.Add(new XElement(DayName, day.Date)); foreach (var lesson in day.ListOfLessons) { var lessonXml = GetLessonToXml(lesson); dayXml.Add(lessonXml); } return dayXml; }
private Day GetDayFromXml(XElement dayXml) { var resultDay = new Day { Date = dayXml.Element(DayName).Value, ListOfLessons = new ObservableCollection<Lesson>() }; foreach (var lessonXml in dayXml.Elements(Lesson)) { var resultLesson = GetLessonFromXml(lessonXml); resultDay.ListOfLessons.Add(resultLesson); } return resultDay; }
public EditDayWindow(Day day) { InitializeComponent(); DataContext = this; ResultDays = new ObservableCollection<Day> {day}; }