private void EditQuiz_Click(object sender, RoutedEventArgs e)
        {
            Window window = new Window()
            {
                Title                 = "Edit Quiz",
                ResizeMode            = ResizeMode.NoResize,
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            window.Loaded += delegate(object o, RoutedEventArgs args)
            {
                QuizCreation quiz = new QuizCreation((comboBox.SelectedItem as Lesson).ID, _contentManager, true, _imagesCache[_selectedFile.Name]);
                window.Height      = quiz.Height + 45;
                window.Width       = quiz.Width + 45;
                quiz.Button.Click += delegate(object sender1, RoutedEventArgs eventArgs)
                {
                    if (quiz.IsSaved())
                    {
                        window.Close();
                    }
                };
                window.Content = quiz;
            };
            window.Closing += delegate(object o, CancelEventArgs args)
            {
                if (!(window.Content as QuizCreation).IsSaved())
                {
                    args.Cancel = true;
                    MessageBox.Show("Progress is not saved!");
                }
                _saved         = false;
                Save.IsEnabled = true;
            };
            window.ShowDialog();
        }
        private void AddQuiz_Click(object sender, RoutedEventArgs e)
        {
            Window window = new Window()
            {
                Title                 = "Add Quiz",
                ResizeMode            = ResizeMode.NoResize,
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            window.Loaded += delegate(object o, RoutedEventArgs args)
            {
                QuizCreation quiz = new QuizCreation((comboBox.SelectedItem as Lesson).ID, _contentManager, false, 0);
                window.Height      = quiz.Height + 45;
                window.Width       = quiz.Width + 45;
                quiz.Button.Click += delegate(object sender1, RoutedEventArgs eventArgs)
                {
                    if (quiz.IsSaved())
                    {
                        if (quiz.NewQuizCreated())
                        {
                            long id      = quiz.NewQuizID();
                            Quiz newQuiz = _contentManager.GetComponent(id) as Quiz;
                            newQuiz.Title = quiz.GetTitle();
                            Image image = new Image()
                            {
                                RenderSize = new Size(65, 65),
                                MaxHeight  = 65,
                                MaxWidth   = 65,
                                Margin     = new Thickness(10),
                                Opacity    = 1,
                                Source     = new BitmapImage(new Uri("pack://application:,,,/Resources/quiz.png")),
                                Name       = "Content_" + id
                            };
                            image.MouseUp += delegate(object obj, MouseButtonEventArgs Args)
                            {
                                if (_selectedFile != null)
                                {
                                    _selectedFile.Opacity = 0.5;
                                }
                                _selectedFile         = obj as Image;
                                _selectedFile.Opacity = 1;
                                LoadContentInfo(_imagesCache[(obj as Image).Name]);
                            };
                            textBoxQuizTitle.Text    = newQuiz.Title;
                            _imagesCache[image.Name] = id;
                            Files.Children.Add(image);
                            _selectedFile        = image;
                            EditQuiz.IsEnabled   = true;
                            DeleteQuiz.IsEnabled = true;
                        }
                        window.Close();
                    }
                };
                window.Content = quiz;
            };
            window.Closing += delegate(object o, CancelEventArgs args)
            {
                if (!(window.Content as QuizCreation).IsSaved())
                {
                    args.Cancel = true;
                    MessageBox.Show("Progress is not saved!");
                }
                _saved         = false;
                Save.IsEnabled = true;
            };
            window.ShowDialog();
        }