Exemplo n.º 1
0
        /// <summary>
        /// Sets the card values.
        /// </summary>
        /// <param name="card">The card.</param>
        /// <remarks>Documented by Dev05, 2007-10-12</remarks>
        private void SetCardValues(ICard card)
        {
            card.Answer.ClearWords();
            card.Question.ClearWords();
            card.Answer.AddWords(GetWord(Side.Answer).Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries));
            card.Question.AddWords(GetWord(Side.Question).Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries));
            card.AnswerDistractors.ClearWords();
            card.QuestionDistractors.ClearWords();
            card.AnswerDistractors.AddWords(GetDistractors(Side.Answer).ToArray());
            card.QuestionDistractors.AddWords(GetDistractors(Side.Question).ToArray());

            card.AnswerExample.ClearWords();
            card.AnswerExample.AddWord(card.AnswerExample.CreateWord(textBoxAnswerExample.Text, WordType.Sentence, false));
            card.QuestionExample.ClearWords();
            card.QuestionExample.AddWord(card.QuestionExample.CreateWord(textBoxQuestionExample.Text, WordType.Sentence, false));

            if (comboBoxChapter.SelectedItem != null && comboBoxChapter.SelectedItem is IChapter)
                card.Chapter = ((IChapter)comboBoxChapter.SelectedItem).Id;
            card.Active = checkBoxActive.Checked;

            card.ClearAllMedia(false);

            try
            {
                this.Parent.Enabled = false;        //ML-2413, maintain doesn't block user inputs while loading stuff into db
                //currently only the DB can show a progress bar
                card.CreateMediaProgressChanged += new StatusMessageEventHandler(card_CreateMediaProgressChanged);
                statusDialog = new LoadStatusMessage(Resources.CARDEDIT_LOADING_MEDIA_TO_DB, 100, dictionary.IsDB);
                if (!(card is DAL.Preview.PreviewCard)) statusDialog.Show();
                statusDialog.SetProgress(0);

                //Image
                if (pictureBoxAnswer.Tag as IImage != null)
                {
                    if (checkBoxResizeAnswer.Checked)
                        ResizePicture(pictureBoxAnswer);
                    card.AddMedia(pictureBoxAnswer.Tag as IMedia, Side.Answer);
                }
                if (pictureBoxQuestion.Tag as IImage != null)
                {
                    if (checkBoxResizeQuestion.Checked)
                        ResizePicture(pictureBoxQuestion);

                    IMedia media = pictureBoxQuestion.Tag as IMedia;
                    media = card.AddMedia(media, Side.Question);

                    if (checkBoxSamePicture.Checked)
                        card.AddMedia(media, Side.Answer);
                }

                //Audio
                if (buttonAnswerAudio.Tag as IAudio != null)
                    card.AddMedia(buttonAnswerAudio.Tag as IMedia, Side.Answer);
                if (buttonAnswerExampleAudio.Tag as IAudio != null)
                    card.AddMedia(buttonAnswerExampleAudio.Tag as IMedia, Side.Answer);
                if (buttonQuestionAudio.Tag as IAudio != null)
                    card.AddMedia(buttonQuestionAudio.Tag as IMedia, Side.Question);
                if (buttonQuestionExampleAudio.Tag as IAudio != null)
                    card.AddMedia(buttonQuestionExampleAudio.Tag as IMedia, Side.Question);

                //video
                if (buttonAnswerVideo.Tag as IVideo != null)
                    card.AddMedia(buttonAnswerVideo.Tag as IMedia, Side.Answer);
                if (buttonQuestionVideo.Tag as IVideo != null)
                    card.AddMedia(buttonQuestionVideo.Tag as IMedia, Side.Question);

                if (card.Active)
                {
                    int oldBox = card.Box;
                    card.Box = comboBoxCardBox.SelectedIndex;
                    int newBox = card.Box;

                    if (oldBox != newBox)
                    {
                        LearnLogStruct lls = new LearnLogStruct();
                        lls.CardsID = card.Id;
                        lls.SessionID = Log.LastSessionID;
                        lls.MoveType = MoveType.Manual;
                        lls.OldBox = oldBox;
                        lls.NewBox = newBox;
                        //Dummy values:
                        lls.TimeStamp = DateTime.Now;
                        lls.Duration = 0;
                        lls.CaseSensitive = false;
                        lls.CorrectOnTheFly = false;
                        lls.Direction = EQueryDirection.Question2Answer;
                        lls.LearnMode = EQueryType.Word;

                        Log.CreateLearnLogEntry(lls, dictionary.DictionaryDAL.Parent);
                    }
                }

                CardID = card.Id;
                Modified = false;
            }
            catch
            {
                throw;
            }
            finally
            {
                this.Parent.Enabled = true;
                card.CreateMediaProgressChanged -= new StatusMessageEventHandler(card_CreateMediaProgressChanged);
                if (statusDialog != null)
                {
                    statusDialog.Close();
                    statusDialog = null;
                }
            }
        }
Exemplo n.º 2
0
Arquivo: Print.cs Projeto: hmehr/OSS
        /// <summary>
        /// Checks the chapter and multimedia (stylesheet) selection, generates the HTML page by arrayList function call and loads the page.
        /// </summary>
        /// <param name="sender">Event Sender, unused.</param>
        /// <param name="e">Event Arguments, unused.</param>
        /// <remarks>Documented by Dev01, 2007-07-19</remarks>
        /// <remarks>Documented by Dev02, 2007-11-23</remarks>
        private void btnPreview_Click(object sender, EventArgs e)
        {
            // Only start the query when at least one chapter and box has been selected
            if (Chapters.GetItemCount() < 1 || (listViewBoxesSelection.CheckedItems.Count < 1 && !checkBoxAllBoxes.Checked))
            {
                MessageBox.Show(Resources.PRINT_SELECT_TEXT, Resources.PRINT_SELECT_CAPTION,
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                this.Enabled = false;

                statusDialog = new LoadStatusMessage(Properties.Resources.PRINT_STATUS_FETCHINGCARDS, 100, false);
                statusDialog.Show();
                statusDialog.SetProgress(0);

                BackgroundWorker worker = new BackgroundWorker();
                worker.WorkerReportsProgress = true;
                worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);

                BackgroundWorker prepareworker = new BackgroundWorker();
                prepareworker.WorkerReportsProgress = true;
                prepareworker.ProgressChanged += new ProgressChangedEventHandler(prepareworker_ProgressChanged);

                System.Collections.Generic.List<int> boxes;
                QueryOrder cardorder;
                QueryOrderDir cardorderdir;
                QueryCardState cardstate;
                GetGUISelection(out boxes, out cardorder, out cardorderdir, out cardstate);

                List<QueryStruct> querystructs = GetQueryStructs(Chapters.SelChapters, boxes, cardstate);

                string stylesheet = ((StyleInfo)comboBoxPrintStyle.SelectedItem).Path;

                List<ICard> cards = Dictionary.GetPrintOutCards(querystructs, cardorder, cardorderdir);

                string htmlContent = Dictionary.GeneratePrintOut(
                    cards,
                    stylesheet,
                    worker,
                    prepareworker);

                statusDialog.InfoMessage = Resources.PRINT_STATUS_RENDERING;
                statusDialog.EnableProgressbar = false;

                Browser.DocumentText = htmlContent;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Modifies the multiple cards.
        /// </summary>
        /// <remarks>Documented by Dev05, 2007-10-12</remarks>
        private void ModifyMultipleCards()
        {
            if (!Multiselect)
                return;

            Cursor = Cursors.WaitCursor;
            LoadStatusMessage statusMessage = new LoadStatusMessage(string.Format(Properties.Resources.CARDEDIT_STATUS_SAVING, cards.Length), cards.Length, true);
            statusMessage.Show();

            string[] question = GetWord(Side.Question).Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            string[] answer = GetWord(Side.Answer).Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            string questionExample = textBoxQuestionExample.Text;
            string answerExample = textBoxAnswerExample.Text;

            foreach (int id in cards)
            {
                Dictionary.Cards.ChangeCardOnDifference(id, question, answer, questionExample, answerExample,
                    (comboBoxChapter.SelectedItem is IChapter ? ((IChapter)comboBoxChapter.SelectedItem).Id : -1), Resources.MAINTAIN_UNCHANGED);

                ICard card = Dictionary.Cards.GetCardByID(id).BaseCard;
                if (checkBoxActive.CheckState != CheckState.Indeterminate)
                    if (card.Active != checkBoxActive.Checked)
                        card.Active = checkBoxActive.Checked;

                if (comboBoxCardBox.SelectedIndex != -1 && card.Active)
                {
                    card.Box = comboBoxCardBox.SelectedIndex;
                }

                //Save old Media objects
                Dictionary<string, IMedia> oldMedia = new Dictionary<string, IMedia>();
                IMedia media = null;
                if ((media = Dictionary.Cards.GetImageObject(card, Side.Answer, true)) != null)
                    oldMedia.Add("answerImage", media);
                if ((media = Dictionary.Cards.GetImageObject(card, Side.Question, true)) != null)
                    oldMedia.Add("questionImage", media);
                if ((media = Dictionary.Cards.GetAudioObject(card, Side.Answer, true, false, true)) != null)
                    oldMedia.Add("answerAudio", media);
                if ((media = Dictionary.Cards.GetAudioObject(card, Side.Question, true, false, true)) != null)
                    oldMedia.Add("questionAudio", media);
                if ((media = Dictionary.Cards.GetAudioObject(card, Side.Answer, false, true, true)) != null)
                    oldMedia.Add("answerExample", media);
                if ((media = Dictionary.Cards.GetAudioObject(card, Side.Question, false, true, true)) != null)
                    oldMedia.Add("questionExample", media);
                if ((media = Dictionary.Cards.GetVideoObject(card, Side.Answer, true)) != null)
                    oldMedia.Add("answerVideo", media);
                if ((media = Dictionary.Cards.GetVideoObject(card, Side.Question, true)) != null)
                    oldMedia.Add("questionVideo", media);

                card.ClearAllMedia(false);

                //Image
                if (pictureBoxAnswer.Tag as IImage != null && checkBoxSamePicture.CheckState != CheckState.Unchecked)
                    card.AddMedia(pictureBoxAnswer.Tag as IMedia, Side.Answer);
                else if (pictureBoxAnswer.Tag is PreviousValueDummy && oldMedia.ContainsKey("answerImage") && checkBoxSamePicture.CheckState != CheckState.Unchecked)
                    card.AddMedia(oldMedia["answerImage"], Side.Answer);
                if (pictureBoxQuestion.Tag as IImage != null)
                {
                    IMedia image = pictureBoxQuestion.Tag as IMedia;
                    card.AddMedia(image, Side.Question);
                    if (checkBoxSamePicture.CheckState == CheckState.Checked)
                        card.AddMedia(image, Side.Answer);
                }
                else if (pictureBoxQuestion.Tag is PreviousValueDummy && oldMedia.ContainsKey("questionImage"))
                {
                    IMedia image = oldMedia["questionImage"];
                    card.AddMedia(image, Side.Question);
                    if (checkBoxSamePicture.CheckState == CheckState.Checked)
                        card.AddMedia(image, Side.Answer);
                }

                //Audio
                if (buttonAnswerAudio.Tag as IAudio != null)
                    card.AddMedia(buttonAnswerAudio.Tag as IMedia, Side.Answer);
                else if (buttonAnswerAudio.Tag is PreviousValueDummy && oldMedia.ContainsKey("answerAudio"))
                    card.AddMedia(oldMedia["answerAudio"], Side.Answer);
                if (buttonAnswerExampleAudio.Tag as IAudio != null)
                    card.AddMedia(buttonAnswerExampleAudio.Tag as IMedia, Side.Answer);
                else if (buttonAnswerExampleAudio.Tag is PreviousValueDummy && oldMedia.ContainsKey("answerExample"))
                    card.AddMedia(oldMedia["answerExample"], Side.Answer);
                if (buttonQuestionAudio.Tag as IAudio != null)
                    card.AddMedia(buttonQuestionAudio.Tag as IMedia, Side.Question);
                else if (buttonQuestionAudio.Tag is PreviousValueDummy && oldMedia.ContainsKey("questionAudio"))
                    card.AddMedia(oldMedia["questionAudio"], Side.Question);
                if (buttonQuestionExampleAudio.Tag as IAudio != null)
                    card.AddMedia(buttonQuestionExampleAudio.Tag as IMedia, Side.Question);
                else if (buttonQuestionExampleAudio.Tag is PreviousValueDummy && oldMedia.ContainsKey("questionExample"))
                    card.AddMedia(oldMedia["questionExample"], Side.Question);

                //Video
                if (buttonAnswerVideo.Tag as IVideo != null)
                    card.AddMedia(buttonAnswerVideo.Tag as IMedia, Side.Answer);
                else if (buttonAnswerVideo.Tag is PreviousValueDummy && oldMedia.ContainsKey("answerVideo"))
                    card.AddMedia(oldMedia["answerVideo"], Side.Answer);
                if (buttonQuestionVideo.Tag as IVideo != null)
                    card.AddMedia(buttonQuestionVideo.Tag as IMedia, Side.Question);
                else if (buttonQuestionVideo.Tag is PreviousValueDummy && oldMedia.ContainsKey("questionVideo"))
                    card.AddMedia(oldMedia["questionVideo"], Side.Question);

                statusMessage.ProgressStep();
            }

            statusMessage.Close();

            Modified = false;
            OnMultiEdit(EventArgs.Empty);
            Cursor = Cursors.Default;
        }
Exemplo n.º 4
0
		private void SyncStatusUpdate(double percentage, string message)
		{
			if (syncStatusMessage == null)
				syncStatusMessage = new LoadStatusMessage(string.Empty, 100, false);
			if (!syncStatusMessage.Visible)
				syncStatusMessage.Show();

			syncStatusMessage.Invoke((MethodInvoker)delegate()
				{
					syncStatusMessage.InfoMessage = message;
					if (percentage <= 100 && percentage >= 0)
					{
						syncStatusMessage.EnableProgressbar = true;
						syncStatusMessage.SetProgress(Convert.ToInt32(percentage));
					}
					else
					{
						syncStatusMessage.EnableProgressbar = false;
						Application.DoEvents();
					}
				});
			if (percentage >= 100)
			{
				syncStatusMessage.Close();
				syncStatusMessage.Dispose();
				syncStatusMessage = null;
			}
		}
Exemplo n.º 5
0
        /// <summary>
        /// Exports the dictionary.
        /// </summary>
        /// <remarks>Documented by Dev05, 2007-08-30</remarks>
        private void ExportDictionary()
        {
            if (exportChapterFrm.Total == 0 || exportFieldsFrm.StrOrder.Length == 0)
            {
                MessageBox.Show(Resources.EXPORTER_NOTHING_SELECTED_TEXT, Resources.EXPORTER_NOTHING_SELECTED_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            SaveFileDialog dlgExportFile = new SaveFileDialog();
            dlgExportFile.Title = Resources.EXPORT_SAVEDIALOG_TITLE;
            dlgExportFile.Filter = Resources.EXPORT_FILETYPE;
            dlgExportFile.AddExtension = true;
            dlgExportFile.OverwritePrompt = true;
            dlgExportFile.CreatePrompt = false;
            dlgExportFile.CheckPathExists = true;

            if (dlgExportFile.ShowDialog() == DialogResult.OK)
            {
                string separator;
                switch (cmbFileFormat.SelectedIndex)
                {
                    case 1:
                        separator = ";";
                        break;
                    case 2:
                        separator = "\t";
                        break;
                    case 0:
                    default:
                        separator = ",";
                        break;
                }

                string chapters = separator;
                foreach (int chapter in exportChapterFrm.SelChapters)
                    chapters += chapter + separator;

                # region header and fields
                string headerline = "";
                bool containsFiles = false;

                XmlDocument document = new XmlDocument();
                document.LoadXml("<fieldsToExport></fieldsToExport>");
                for (int i = 0; i < exportFieldsFrm.StrOrder.Length; i++)
                {
                    headerline += exportFieldsFrm.StrOrder[i];
                    headerline += separator;

                    string caption = exportFieldsFrm.StrOrder[i];
                    XmlNode node = document.CreateNode(XmlNodeType.Element, "fieldName", null);

                    if (isSameField(caption,Resources.LISTBOXFIELDS_QUESTION_DISTRACTORS_TEXT))
                    {
                        node.InnerText += "questiondistractors";
                    }
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_ANSWER_DISTRACTORS_TEXT))
                    {
                        node.InnerText += "answerdistractors";
                    }
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_ANSWER_TEXT))
                        node.InnerText += "answer";
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_EXANSWER_TEXT))
                        node.InnerText += "answerexample";
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_QUESTION_TEXT))
                        node.InnerText += "question";
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_EXQUESTION_TEXT))
                        node.InnerText += "questionexample";
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_IMAGE_ANSWER_TEXT))
                    {
                        node.InnerText += "answerimage";
                        containsFiles = true;
                    }
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_IMAGE_QUESTION_TEXT))
                    {
                        node.InnerText += "questionimage";
                        containsFiles = true;
                    }
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_SOUND_ANSWER_TEXT))
                    {
                        node.InnerText += "answeraudio";
                        containsFiles = true;
                    }
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_SOUND_EXANSWER_TEXT))
                    {
                        node.InnerText += "answerexampleaudio";
                        containsFiles = true;
                    }
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_SOUND_EXQUESTION_TEXT))
                    {
                        node.InnerText += "questionexampleaudio";
                        containsFiles = true;
                    }
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_SOUND_QUESTION_TEXT))
                    {
                        node.InnerText += "questionaudio";
                        containsFiles = true;
                    }
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_VIDEO_ANSWER_TEXT))
                    {
                        node.InnerText += "answervideo";
                        containsFiles = true;
                    }
                    else if (isSameField(caption,Resources.LISTBOXFIELDS_VIDEO_QUESTION_TEXT))
                    {
                        node.InnerText += "questionvideo";
                        containsFiles = true;
                    }
                    else if (caption == Resources.LISTBOXFIELDS_CHAPTER)
                        node.InnerText += "chapter";

                    document.DocumentElement.AppendChild(node);
                }
                headerline = headerline.Remove(headerline.LastIndexOf(separator));
                # endregion

                bool copyFiles = false;
                if (containsFiles)
                {
                    copyFiles = (0 == MLifter.Controls.TaskDialog.ShowCommandBox(Resources.EXPORTER_COPY_MEDIA_TITLE, Resources.EXPORTER_COPY_MEDIA_TEXT,
                        Resources.EXPORTER_COPY_MEDIA_CONTENT, string.Empty, string.Empty, string.Empty, Properties.Resources.EXPORTER_COPY_MEDIA_COMMANDS, false,
                        MLifter.Controls.TaskDialogIcons.Question, MLifter.Controls.TaskDialogIcons.Question));
                }

                statusDialog = new LoadStatusMessage(Properties.Resources.EXPORT_STATUS_CAPTION, 100, true);
                statusDialog.Show();

                bool exceptionhappened = false;
                try
                {
                    Exporter exporter = new Exporter();
                    exporter.ProgressChanged += new EventHandler<MLifter.DAL.Tools.StatusMessageEventArgs>(exporter_ProgressChanged);
                    exporter.ExportToCSV(dlgExportFile.FileName, Path.Combine(Application.StartupPath, @"Designs\System\Export\default.xsl"),
                        MainForm.LearnLogic.Dictionary.DictionaryDAL, separator, chapters, headerline, copyFiles, document);
                }
                catch (IOException exp)
                {
                    exceptionhappened = true;
                    MessageBox.Show(Properties.Resources.DIC_ERROR_SAVING_TEXT, Properties.Resources.DIC_ERROR_SAVING_CAPTION);
                    System.Diagnostics.Trace.WriteLine("Export file save exception: " + exp.ToString());
                }

                statusDialog.Hide();

                if (!exceptionhappened)
                    Close();
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Constructor for the Class for centralizing dictionary access in the Maintain Cards form.
        /// </summary>
        /// <remarks>Documented by Dev02, 2007-12-17</remarks>
        public MaintainCardDB(LoadStatusMessage statusMessage)
        {
            Dictionary.PreloadCardCache();
            //populate chapters dictionary
            foreach (IChapter chapter in Dictionary.Chapters.Chapters)
                chapters.Add(chapter.Id, chapter);

            //populate cards dictionary
            int counter = 0;
            int count = Dictionary.Cards.Cards.Count;
            foreach (ICard card in Dictionary.Cards.Cards)
            {
                if (counter++ % 10 == 0)
                    statusMessage.SetProgress(Convert.ToInt32((counter * 1.0 / count) * 100));
                IndexAdd(card);
            }
            statusMessage.SetProgress(100);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Modifies the multiple cards.
        /// </summary>
        /// <remarks>Documented by Dev05, 2007-10-12</remarks>
        private void ModifyMultipleCards()
        {
            if (!Multiselect)
            {
                return;
            }

            Cursor = Cursors.WaitCursor;
            LoadStatusMessage statusMessage = new LoadStatusMessage(string.Format(Properties.Resources.CARDEDIT_STATUS_SAVING, cards.Length), cards.Length, true);

            statusMessage.Show();

            string[] question = GetWord(Side.Question).Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            string[] answer   = GetWord(Side.Answer).Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            string questionExample = textBoxQuestionExample.Text;
            string answerExample   = textBoxAnswerExample.Text;

            foreach (int id in cards)
            {
                Dictionary.Cards.ChangeCardOnDifference(id, question, answer, questionExample, answerExample,
                                                        (comboBoxChapter.SelectedItem is IChapter ? ((IChapter)comboBoxChapter.SelectedItem).Id : -1), Resources.MAINTAIN_UNCHANGED);

                ICard card = Dictionary.Cards.GetCardByID(id).BaseCard;
                if (checkBoxActive.CheckState != CheckState.Indeterminate)
                {
                    if (card.Active != checkBoxActive.Checked)
                    {
                        card.Active = checkBoxActive.Checked;
                    }
                }

                if (comboBoxCardBox.SelectedIndex != -1 && card.Active)
                {
                    card.Box = comboBoxCardBox.SelectedIndex;
                }

                //Save old Media objects
                Dictionary <string, IMedia> oldMedia = new Dictionary <string, IMedia>();
                IMedia media = null;
                if ((media = Dictionary.Cards.GetImageObject(card, Side.Answer, true)) != null)
                {
                    oldMedia.Add("answerImage", media);
                }
                if ((media = Dictionary.Cards.GetImageObject(card, Side.Question, true)) != null)
                {
                    oldMedia.Add("questionImage", media);
                }
                if ((media = Dictionary.Cards.GetAudioObject(card, Side.Answer, true, false, true)) != null)
                {
                    oldMedia.Add("answerAudio", media);
                }
                if ((media = Dictionary.Cards.GetAudioObject(card, Side.Question, true, false, true)) != null)
                {
                    oldMedia.Add("questionAudio", media);
                }
                if ((media = Dictionary.Cards.GetAudioObject(card, Side.Answer, false, true, true)) != null)
                {
                    oldMedia.Add("answerExample", media);
                }
                if ((media = Dictionary.Cards.GetAudioObject(card, Side.Question, false, true, true)) != null)
                {
                    oldMedia.Add("questionExample", media);
                }
                if ((media = Dictionary.Cards.GetVideoObject(card, Side.Answer, true)) != null)
                {
                    oldMedia.Add("answerVideo", media);
                }
                if ((media = Dictionary.Cards.GetVideoObject(card, Side.Question, true)) != null)
                {
                    oldMedia.Add("questionVideo", media);
                }

                card.ClearAllMedia(false);

                //Image
                if (pictureBoxAnswer.Tag as IImage != null && checkBoxSamePicture.CheckState != CheckState.Unchecked)
                {
                    card.AddMedia(pictureBoxAnswer.Tag as IMedia, Side.Answer);
                }
                else if (pictureBoxAnswer.Tag is PreviousValueDummy && oldMedia.ContainsKey("answerImage") && checkBoxSamePicture.CheckState != CheckState.Unchecked)
                {
                    card.AddMedia(oldMedia["answerImage"], Side.Answer);
                }
                if (pictureBoxQuestion.Tag as IImage != null)
                {
                    IMedia image = pictureBoxQuestion.Tag as IMedia;
                    card.AddMedia(image, Side.Question);
                    if (checkBoxSamePicture.CheckState == CheckState.Checked)
                    {
                        card.AddMedia(image, Side.Answer);
                    }
                }
                else if (pictureBoxQuestion.Tag is PreviousValueDummy && oldMedia.ContainsKey("questionImage"))
                {
                    IMedia image = oldMedia["questionImage"];
                    card.AddMedia(image, Side.Question);
                    if (checkBoxSamePicture.CheckState == CheckState.Checked)
                    {
                        card.AddMedia(image, Side.Answer);
                    }
                }

                //Audio
                if (buttonAnswerAudio.Tag as IAudio != null)
                {
                    card.AddMedia(buttonAnswerAudio.Tag as IMedia, Side.Answer);
                }
                else if (buttonAnswerAudio.Tag is PreviousValueDummy && oldMedia.ContainsKey("answerAudio"))
                {
                    card.AddMedia(oldMedia["answerAudio"], Side.Answer);
                }
                if (buttonAnswerExampleAudio.Tag as IAudio != null)
                {
                    card.AddMedia(buttonAnswerExampleAudio.Tag as IMedia, Side.Answer);
                }
                else if (buttonAnswerExampleAudio.Tag is PreviousValueDummy && oldMedia.ContainsKey("answerExample"))
                {
                    card.AddMedia(oldMedia["answerExample"], Side.Answer);
                }
                if (buttonQuestionAudio.Tag as IAudio != null)
                {
                    card.AddMedia(buttonQuestionAudio.Tag as IMedia, Side.Question);
                }
                else if (buttonQuestionAudio.Tag is PreviousValueDummy && oldMedia.ContainsKey("questionAudio"))
                {
                    card.AddMedia(oldMedia["questionAudio"], Side.Question);
                }
                if (buttonQuestionExampleAudio.Tag as IAudio != null)
                {
                    card.AddMedia(buttonQuestionExampleAudio.Tag as IMedia, Side.Question);
                }
                else if (buttonQuestionExampleAudio.Tag is PreviousValueDummy && oldMedia.ContainsKey("questionExample"))
                {
                    card.AddMedia(oldMedia["questionExample"], Side.Question);
                }

                //Video
                if (buttonAnswerVideo.Tag as IVideo != null)
                {
                    card.AddMedia(buttonAnswerVideo.Tag as IMedia, Side.Answer);
                }
                else if (buttonAnswerVideo.Tag is PreviousValueDummy && oldMedia.ContainsKey("answerVideo"))
                {
                    card.AddMedia(oldMedia["answerVideo"], Side.Answer);
                }
                if (buttonQuestionVideo.Tag as IVideo != null)
                {
                    card.AddMedia(buttonQuestionVideo.Tag as IMedia, Side.Question);
                }
                else if (buttonQuestionVideo.Tag is PreviousValueDummy && oldMedia.ContainsKey("questionVideo"))
                {
                    card.AddMedia(oldMedia["questionVideo"], Side.Question);
                }

                statusMessage.ProgressStep();
            }

            statusMessage.Close();

            Modified = false;
            OnMultiEdit(EventArgs.Empty);
            Cursor = Cursors.Default;
        }