private void LoadQuestions() { if (_selectedQuiz != 0) { questions = _contentManager.GetAllQuestions(_selectedQuiz); } else { long id = _contentManager.AddQuiz(_selectedLesson, ""); if (id > 0) { _selectedQuiz = id; _newQuiz = true; _newQuizID = id; questions = new ObservableCollection <Question>(); } else if (id == 0) { _selectedQuiz = _contentManager.GetComponent(_selectedLesson).ID; questions = _contentManager.GetAllQuestions(_selectedQuiz); Component comp = _contentManager.GetComponent(_selectedQuiz); if (comp is Quiz) { textBoxTitle.Text = (comp as Quiz).Title; } } } listBox.ItemsSource = questions; listBox.DisplayMemberPath = "Text"; _saved = true; }