Ejemplo n.º 1
0
        /// <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();
            }
        }
Ejemplo n.º 2
0
        /// <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();
            }
        }
Ejemplo n.º 3
0
        /// <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();
        }
Ejemplo n.º 4
0
        /// <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();
        }