private void CreateSubject(object sender, EventArgs e) { var questionDialog = new QuestionDialog("Subject"); if (questionDialog.Run(treeView.ParentWindow) == Command.Ok) { var subject = new Subject { Title = questionDialog.Result }; DatabaseManager.Instance.SaveOrUpdate(subject); AddSubject(subject); } questionDialog.Dispose(); }
private void CreateLesson(object sender, EventArgs e) { var questionDialog = new QuestionDialog("Lesson"); if (questionDialog.Run(treeView.ParentWindow) == Command.Ok) { var lesson = new Lesson { Title = questionDialog.Result }; // Append lesson to the current selected subject var subjectNavigator = SearchSubjectNode(); var selectedSubject = subjectNavigator.GetValue(subjectCol); selectedSubject.AddLesson(lesson); DatabaseManager.Instance.SaveOrUpdate(selectedSubject); AddLesson(subjectNavigator, lesson); } questionDialog.Dispose(); }