private void TMP() { _contentManager.AddCourse("Serbian", "./Resources/Flag of Serbia.png"); //_contentManager.EditCourse(1, null, "./Resources/Flag of Serbia.png"); //_contentManager.AddEducationalLevel(Icons.Nursery, 2); _contentManager.AddEducationalLevel(1, "pack://application:,,,/Resources/nursery.jpg", EducationalLevelType.Nursery); //_contentManager.EditEducationalLevel(2, "./Resources/nursery.png", 0); //_contentManager.DeleteEducationalLevel(2, 1); _contentManager.AddGrade(2, "pack://application:,,,/Resources/nursery.jpg", GradeType.NurseryI); //_contentManager.EditGrade(3, "", GradeType.NurseryI); //_contentManager.DeleteGrade(3, 2); _contentManager.AddWeek(3, "Week 1", 1, 1); //_contentManager.EditWeek(4, "Week 1", 1, 1); //_contentManager.DeleteWeek(4, 3); _contentManager.AddLesson(4, "Lesson 1", 1); // _contentManager.EditLesson(5, "Lesson 1", 1); //_contentManager.DeleteLesson(5, 4); _contentManager.AddQuiz(5, "Quiz 1"); //_contentManager.EditQuiz(6, "Quiz 1"); //_contentManager.DeleteQuiz(6, 5); //_contentManager.AddQuestion(6, "How old are you?", "I am 24 years old.", QuestionType.Puzzle); //_contentManager.EditQuestion(7, "How old are you", "I am 24 years old.", QuestionType.Puzzle); //_contentManager.DeleteQuestion(7, 6); _contentManager.AddContentFile(5, ComponentType.Audio, "", "", "", 2, "HEHEHE"); //_contentManager.EditContentFile(8, ComponentType.Audio, "", "", "", 2, "HEHEHE"); }
private void Add_OnClick(object sender, RoutedEventArgs e) { if (comboBox.SelectedItem != null) { OpenFileDialog dialog = new OpenFileDialog(); var res = dialog.ShowDialog(); if (res != null && res == true) { string selectedFile = dialog.FileName; byte[] bytes = File.ReadAllBytes(selectedFile); string name = selectedFile.Split('\\').Last(); long size = new FileInfo(dialog.FileName).Length; //change path long id = _contentManager.AddContentFile(((Lesson)comboBox.SelectedItem).ID, CheckType(selectedFile), name, name, selectedFile, size, ""); if (id > 0) { string icon = ""; switch (CheckType(selectedFile)) { case ComponentType.Audio: radioButtonAudio.IsChecked = true; icon = "pack://application:,,,/Resources/audio.png"; break; case ComponentType.Video: icon = "pack://application:,,,/Resources/video.png"; radioButtonVideo.IsChecked = true; break; case ComponentType.Document: icon = "pack://application:,,,/Resources/document.png"; radioButtonDocument.IsChecked = true; break; } //change path _contentManager.EditContentFile(id, CheckType(selectedFile), icon, name, name, size, ""); Image image = new Image() { RenderSize = new Size(65, 65), MaxHeight = 65, MaxWidth = 65, Margin = new Thickness(10), Opacity = 1, Source = new BitmapImage(new Uri(icon)), Name = "Content_" + id }; image.MouseUp += delegate(object o, MouseButtonEventArgs args) { if (_selectedFile != null) { _selectedFile.Opacity = 0.5; } _selectedFile = o as Image; _selectedFile.Opacity = 1; LoadContentInfo(_imagesCache[(o as Image).Name]); }; _imagesCache[image.Name] = id; Files.Children.Add(image); if (_selectedFile != null) { _selectedFile.Opacity = 0.5; } _selectedFile = image; Edit.IsEnabled = true; Delete.IsEnabled = true; //change URI TextBoxURI.Text = name; textBoxTitle.Text = name; textBoxDescription.Text = ""; _saved = false; Save.IsEnabled = true; } } } else { MessageBox.Show("Lesson is not selected!!!"); } }