Beispiel #1
0
 /// <summary>
 /// Generates the preview card.
 /// </summary>
 /// <returns></returns>
 /// <remarks>Documented by Dev05, 2009-10-13</remarks>
 private Card GeneratePreviewCard()
 {
     MLifter.DAL.Preview.PreviewCard pcard = new MLifter.DAL.Preview.PreviewCard(null);
     pcard.Answer.AddWord(pcard.Answer.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER, WordType.Word, true));
     pcard.AnswerExample.AddWord(pcard.AnswerExample.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER_EXAMPLE, WordType.Sentence, false));
     pcard.Question.AddWord(pcard.Question.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION, WordType.Word, true));
     pcard.QuestionExample.AddWord(pcard.QuestionExample.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION_EXAMPLE, WordType.Sentence, false));
     return(new Card(pcard, dictionary));
 }
        /// <summary>
        /// Handles the Click event of the buttonStyle control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev02, 2008-02-06</remarks>
        private void buttonStyle_Click(object sender, EventArgs e)
        {
            if (DBChapters.SelectedItems.Count == 0)
            {
                return;
            }
            ICard    card;
            IChapter chapter = (IChapter)DBChapters.SelectedItems[0].Tag;

            System.Collections.Generic.List <ICard> cards = Dictionary.GetCardsFromChapter(chapter);
            if (cards.Count > 0)
            {
                card = cards[0];
            }
            else
            {
                card         = new MLifter.DAL.Preview.PreviewCard(null);
                card.Chapter = chapter.Id;
                card.Answer.AddWord(card.Answer.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER, WordType.Word, true));
                card.AnswerExample.AddWord(card.AnswerExample.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER_EXAMPLE, WordType.Sentence, false));
                card.Question.AddWord(card.Question.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION, WordType.Word, true));
                card.QuestionExample.AddWord(card.QuestionExample.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION_EXAMPLE, WordType.Sentence, false));
            }

            if (((IChapter)DBChapters.SelectedItems[0].Tag).Settings == null)
            {
                ((IChapter)DBChapters.SelectedItems[0].Tag).Settings = Dictionary.CreateSettings();
            }
            if (((IChapter)DBChapters.SelectedItems[0].Tag).Settings.Style == null)
            {
                ((IChapter)DBChapters.SelectedItems[0].Tag).Settings.Style = ((IChapter)DBChapters.SelectedItems[0].Tag).CreateCardStyle();
            }

            MLifter.Controls.CardStyleEditor editor = new MLifter.Controls.CardStyleEditor();
            editor.HelpNamespace = MLifter.Classes.Help.HelpPath;
            editor.LoadStyle(card, ((IChapter)DBChapters.SelectedItems[0].Tag).Settings.Style, Dictionary, DBChapters.SelectedItems[0].Tag);
            switch (editor.ShowDialog())
            {
            case DialogResult.Abort:
                ((IChapter)DBChapters.SelectedItems[0].Tag).Settings.Style = null;
                break;

            case DialogResult.Cancel:
                break;

            default:
                Dictionary.UseDictionaryStyleSheets = true;
                break;
            }
            //cleanup
            if (card != null)
            {
                card.Dispose();
            }
        }
        /// <summary>
        /// Handles the Click event of the buttonStyle control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev08, 2009-03-27</remarks>
        private void buttonStyle_Click(object sender, EventArgs e)
        {
            ICard card;

            if (dictionary.Cards.Cards.Count > 0)
            {
                card = dictionary.Cards.Cards[0];
            }
            else
            {
                if (dictionary.Chapters.Chapters.Count == 0)
                {
                    return;
                }
                card         = new MLifter.DAL.Preview.PreviewCard(null);
                card.Chapter = dictionary.Chapters.Chapters[0].Id;
                card.Answer.AddWord(card.Answer.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER, WordType.Word, true));
                card.AnswerExample.AddWord(card.AnswerExample.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER_EXAMPLE, WordType.Sentence, false));
                card.Question.AddWord(card.Question.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION, WordType.Word, true));
                card.QuestionExample.AddWord(card.QuestionExample.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION_EXAMPLE, WordType.Sentence, false));
            }

            MLifter.Controls.CardStyleEditor editor = new MLifter.Controls.CardStyleEditor();
            editor.LoadStyle(card, dictionary.Settings.Style, dictionary, dictionary.DictionaryDAL);

            switch (editor.ShowDialog())
            {
            case DialogResult.Abort:
                dictionary.Settings.Style = null;
                break;

            case DialogResult.Cancel:
                break;

            default:
                dictionary.UseDictionaryStyleSheets = true;
                break;
            }
            //cleanup
            if (card != null)
            {
                card.Dispose();
            }
        }
        /// <summary>
        /// Handles the Click event of the buttonStyle control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev08, 2009-03-27</remarks>
        private void buttonStyle_Click(object sender, EventArgs e)
        {
            ICard card;
            if (dictionary.Cards.Cards.Count > 0)
            {
                card = dictionary.Cards.Cards[0];
            }
            else
            {
                if (dictionary.Chapters.Chapters.Count == 0)
                    return;
                card = new MLifter.DAL.Preview.PreviewCard(null);
                card.Chapter = dictionary.Chapters.Chapters[0].Id;
                card.Answer.AddWord(card.Answer.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER, WordType.Word, true));
                card.AnswerExample.AddWord(card.AnswerExample.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER_EXAMPLE, WordType.Sentence, false));
                card.Question.AddWord(card.Question.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION, WordType.Word, true));
                card.QuestionExample.AddWord(card.QuestionExample.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION_EXAMPLE, WordType.Sentence, false));
            }

            MLifter.Controls.CardStyleEditor editor = new MLifter.Controls.CardStyleEditor();
            editor.LoadStyle(card, dictionary.Settings.Style, dictionary, dictionary.DictionaryDAL);

            switch (editor.ShowDialog())
            {
                case DialogResult.Abort:
                    dictionary.Settings.Style = null;
                    break;
                case DialogResult.Cancel:
                    break;
                default:
                    dictionary.UseDictionaryStyleSheets = true;
                    break;
            }
            //cleanup
            if (card != null) card.Dispose();
        }
Beispiel #5
0
 /// <summary>
 /// Generates the preview card.
 /// </summary>
 /// <returns></returns>
 /// <remarks>Documented by Dev05, 2009-10-13</remarks>
 private Card GeneratePreviewCard()
 {
     MLifter.DAL.Preview.PreviewCard pcard = new MLifter.DAL.Preview.PreviewCard(null);
     pcard.Answer.AddWord(pcard.Answer.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER, WordType.Word, true));
     pcard.AnswerExample.AddWord(pcard.AnswerExample.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER_EXAMPLE, WordType.Sentence, false));
     pcard.Question.AddWord(pcard.Question.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION, WordType.Word, true));
     pcard.QuestionExample.AddWord(pcard.QuestionExample.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION_EXAMPLE, WordType.Sentence, false));
     return new Card(pcard, dictionary);
 }
        /// <summary>
        /// Handles the Click event of the buttonStyle control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev02, 2008-02-06</remarks>
        private void buttonStyle_Click(object sender, EventArgs e)
        {
            if (DBChapters.SelectedItems.Count == 0)
                return;
            ICard card;
            IChapter chapter = (IChapter)DBChapters.SelectedItems[0].Tag;
            System.Collections.Generic.List<ICard> cards = Dictionary.GetCardsFromChapter(chapter);
            if (cards.Count > 0)
            {
                card = cards[0];
            }
            else
            {
                card = new MLifter.DAL.Preview.PreviewCard(null);
                card.Chapter = chapter.Id;
                card.Answer.AddWord(card.Answer.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER, WordType.Word, true));
                card.AnswerExample.AddWord(card.AnswerExample.CreateWord(Properties.Resources.EXAMPLE_CARD_ANSWER_EXAMPLE, WordType.Sentence, false));
                card.Question.AddWord(card.Question.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION, WordType.Word, true));
                card.QuestionExample.AddWord(card.QuestionExample.CreateWord(Properties.Resources.EXAMPLE_CARD_QUESTION_EXAMPLE, WordType.Sentence, false));
            }

            if (((IChapter)DBChapters.SelectedItems[0].Tag).Settings == null)
                ((IChapter)DBChapters.SelectedItems[0].Tag).Settings = Dictionary.CreateSettings();
            if (((IChapter)DBChapters.SelectedItems[0].Tag).Settings.Style == null)
                ((IChapter)DBChapters.SelectedItems[0].Tag).Settings.Style = ((IChapter)DBChapters.SelectedItems[0].Tag).CreateCardStyle();

            MLifter.Controls.CardStyleEditor editor = new MLifter.Controls.CardStyleEditor();
            editor.HelpNamespace = MLifter.Classes.Help.HelpPath;
            editor.LoadStyle(card, ((IChapter)DBChapters.SelectedItems[0].Tag).Settings.Style, Dictionary, DBChapters.SelectedItems[0].Tag);
            switch (editor.ShowDialog())
            {
                case DialogResult.Abort:
                    ((IChapter)DBChapters.SelectedItems[0].Tag).Settings.Style = null;
                    break;
                case DialogResult.Cancel:
                    break;
                default:
                    Dictionary.UseDictionaryStyleSheets = true;
                    break;
            }
            //cleanup
            if (card != null) card.Dispose();
        }