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; }
/// <summary> /// /// </summary> /// <param name="id"></param> private void LoadEducationalLevels(long id) { WrapPanelEducationaLevel.Children.Clear(); List <long> childrenIDs = _contentManager.GetChildrenIDs(id); if (childrenIDs != null) { foreach (int childID in childrenIDs) { EducationalLevel level = _contentManager.GetComponent(childID) as EducationalLevel; Image image = new Image() { Source = new BitmapImage(new Uri(level.Icon)), RenderSize = new Size(100, 100), MaxHeight = 100, MaxWidth = 100, Margin = new Thickness(15), Opacity = 0.5, Visibility = Visibility.Visible, Name = "Icon_" + level.ID }; image.MouseUp += delegate(object sender, MouseButtonEventArgs args) { ImageEducationaLevel_Click(sender as Image); }; _educationalLevelDictionary[image.Name] = childID; WrapPanelEducationaLevel.Children.Add(image); _selectedEducationalLevel = image; } } WrapPanelGrades.Children.Clear(); NoOfLessons.Text = "0"; NoOfFiles.Text = "0"; NoOfWeeks.Text = "0"; }
private void LoadLessons() { if (_topics) { lessons = _contentManager.GetAllTopicsLessons(); } else { lessons = _contentManager.GetAllLessons(_contentManager.GetComponent(_selectedGrade)); } comboBox.ItemsSource = lessons; comboBox.DisplayMemberPath = "Title"; }
private void LoadWeeks() { foreach (Week week in _contentManager.GetAllWeeks(_contentManager.GetComponent(_selecetedGrade))) { if (week.Term == 1) { TermI.Add(week); } else if (week.Term == 2) { TermII.Add(week); } else if (week.Term == 3) { TermIII.Add(week); } } }
public void LoadParentComponents() { if (_topics) { parentComponents = _contentManager.GetAllTopics(); numOfLessons = _contentManager.GetNoOfTopicsLessons(); } else { parentComponents = _contentManager.GetAllWeeks(_contentManager.GetComponent(_selectedGrade)); numOfLessons = _contentManager.GetNoOfLessons(_selectedGrade); } listBox.ItemsSource = parentComponents; listBox.DisplayMemberPath = "Title"; listBox.Items.Refresh(); for (int i = 0; i < 100; i++) { comboBox.Items.Add((i + 1).ToString()); } comboBox.Text = 1.ToString(); }
public QuizCreation(long parent, Diction_Master___Library.ContentManager manager, bool edit, long quiz) { _contentManager = manager; _selectedLesson = parent; _edit = edit; _wrongAnswers = new ObservableCollection <string>(); InitializeComponent(); if (edit) { _selectedQuiz = quiz; textBoxTitle.Text = (_contentManager.GetComponent(quiz) as Quiz).Title; } LoadQuestions(); }
private void Add_Click(object sender, RoutedEventArgs e) { if (textBox.Text != "") { long id = _contentManager.AddTopic(textBox.Text, Convert.ToInt16(comboBox.SelectedValue)); if (id > 0) { _topics.Add(_contentManager.GetComponent(id) as Topic); listBox.Items.Refresh(); _saved = false; Confirm.IsEnabled = true; _empty = false; EditLessons.IsEnabled = true; } } }