Ejemplo n.º 1
0
 /// <summary>
 /// Selects the card tree view items.
 /// </summary>
 /// <param name="chapterTreeViewItem">The chapter tree view item.</param>
 /// <remarks>Documented by Dev08, 2009-07-15</remarks>
 private void DeselectCardTreeViewItems(ChapterTreeViewItem chapterTreeViewItem)
 {
     foreach (CardTreeViewItem cardTreeViewItem in chapterTreeViewItem.Cards)
     {
         cardTreeViewItem.IsChecked = false;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Inverts the selection card tree view items.
 /// </summary>
 /// <param name="chapterTreeViewItem">The chapter tree view item.</param>
 /// <remarks>Documented by Dev08, 2009-07-15</remarks>
 private void InvertSelectionCardTreeViewItems(ChapterTreeViewItem chapterTreeViewItem)
 {
     foreach (CardTreeViewItem cardTreeViewItem in chapterTreeViewItem.Cards)
     {
         cardTreeViewItem.IsChecked = !cardTreeViewItem.IsChecked;
     }
 }
Ejemplo n.º 3
0
        public CardTreeViewItem(ICard card, ChapterTreeViewItem parent)
            : base(parent)
        {
            this.card = card;

            //Cache
            question = BusinessLogic.HtmlHelper.HtmlStripTags(card.Question.ToString(), false, true);
            answer = BusinessLogic.HtmlHelper.HtmlStripTags(card.Answer.ToString(), false, true);
            questionExample = BusinessLogic.HtmlHelper.HtmlStripTags(card.QuestionExample.ToString(), false, true);
            answerExample = BusinessLogic.HtmlHelper.HtmlStripTags(card.AnswerExample.ToString(), false, true);
            id = card.Id;
            hasCustomSettings = card.Settings != null && !SettingsManagerBusinessLogic.IsEmptySetting(card.Settings) ? true : false;
        }
Ejemplo n.º 4
0
        public CardTreeViewItem(ICard card, ChapterTreeViewItem parent)
            : base(parent)
        {
            this.card = card;

            //Cache
            question        = BusinessLogic.HtmlHelper.HtmlStripTags(card.Question.ToString(), false, true);
            answer          = BusinessLogic.HtmlHelper.HtmlStripTags(card.Answer.ToString(), false, true);
            questionExample = BusinessLogic.HtmlHelper.HtmlStripTags(card.QuestionExample.ToString(), false, true);
            answerExample   = BusinessLogic.HtmlHelper.HtmlStripTags(card.AnswerExample.ToString(), false, true);
            id = card.Id;
            hasCustomSettings = card.Settings != null && !SettingsManagerBusinessLogic.IsEmptySetting(card.Settings) ? true : false;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Handles the Opened event of the contextMenuChapter control.
        /// Usability: Selects the treeViewItem, which was used to open the context menu
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev08, 2009-07-15</remarks>
        private void contextMenuChapter_Opened(object sender, RoutedEventArgs e)
        {
            if (!(sender is ContextMenu))
            {
                return;
            }

            ChapterTreeViewItem chapterTreeViewItem = (sender as ContextMenu).Tag as ChapterTreeViewItem;

            if (chapterTreeViewItem == null)
            {
                return;
            }

            chapterTreeViewItem.IsSelected = true;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Handles the Click event of the menuItemInvertSelection control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev08, 2009-07-15</remarks>
        private void menuItemInvertSelection_Click(object sender, RoutedEventArgs e)
        {
            if (!(sender is MenuItem))
            {
                return;
            }

            ChapterTreeViewItem chapterTreeViewItem = (sender as MenuItem).Tag as ChapterTreeViewItem;

            if (chapterTreeViewItem == null)
            {
                return;
            }

            InvertSelectionCardTreeViewItems(chapterTreeViewItem);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Handles the Click event of the menuItemDeselectAllCards control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev08, 2009-07-15</remarks>
        private void menuItemDeselectAllCards_Click(object sender, RoutedEventArgs e)
        {
            if (!(sender is MenuItem))
            {
                return;
            }

            ChapterTreeViewItem chapterTreeViewItem = (sender as MenuItem).Tag as ChapterTreeViewItem;

            if (chapterTreeViewItem == null)
            {
                return;
            }

            DeselectCardTreeViewItems(chapterTreeViewItem);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Loads the content.
        /// </summary>
        /// <remarks>Documented by Dev08, 2009-07-15</remarks>
        private void LoadContent()
        {
            Chapters = new ObservableCollection <ChapterTreeViewItem>();

            int counter = 0;
            int max     = learningModule.Chapters.Count;

            foreach (IChapter chapter in learningModule.Chapters.Chapters)
            {
                ChapterTreeViewItem item = new ChapterTreeViewItem(chapter, this);
                item.Cards = new ObservableCollection <CardTreeViewItem>();
                Chapters.Add(item);
                ++counter;
            }

            counter = 0;
            max     = learningModule.Cards.Count;
            foreach (ICard card in learningModule.Cards.Cards)
            {
                context.Post(new SendOrPostCallback(delegate(object state)
                {
                    OnContentLoading(this, new ContentLoadingEventArgs(counter, max, ContentType.Card));
                }), null);

                foreach (ChapterTreeViewItem item in Chapters)
                {
                    if (item.Id == card.Chapter)
                    {
                        item.Cards.Add(new CardTreeViewItem(card, item));
                        break;
                    }
                }
                ++counter;
            }

            context.Post(new SendOrPostCallback(delegate(object state)
            {
                OnContentLoaded(this, EventArgs.Empty);
            }), null);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Handles the SelectedItemChanged event of the treeViewLearningModule control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedPropertyChangedEventArgs&lt;System.Object&gt;"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev08, 2009-07-20</remarks>
        private void treeViewLearningModule_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (!(sender is TreeView))
            {
                return;
            }

            if ((sender as TreeView).SelectedItem is LearningModuleTreeViewItem)
            {
                LearningModuleTreeViewItem learningModuleTreeViewItem = (sender as TreeView).SelectedItem as LearningModuleTreeViewItem;
                settingsControlMain.SetSettings(learningModuleTreeViewItem.Settings);
            }
            else if ((sender as TreeView).SelectedItem is ChapterTreeViewItem)
            {
                ChapterTreeViewItem chapterTreeViewItem = (sender as TreeView).SelectedItem as ChapterTreeViewItem;
                settingsControlMain.SetSettings(chapterTreeViewItem.Settings);
            }
            else if ((sender as TreeView).SelectedItem is CardTreeViewItem)
            {
                CardTreeViewItem cardTreeViewItem = (sender as TreeView).SelectedItem as CardTreeViewItem;
                settingsControlMain.SetSettings(cardTreeViewItem.Settings);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Loads the content.
        /// </summary>
        /// <remarks>Documented by Dev08, 2009-07-15</remarks>
        private void LoadContent()
        {
            Chapters = new ObservableCollection<ChapterTreeViewItem>();

            int counter = 0;
            int max = learningModule.Chapters.Count;
            foreach (IChapter chapter in learningModule.Chapters.Chapters)
            {
                ChapterTreeViewItem item = new ChapterTreeViewItem(chapter, this);
                item.Cards = new ObservableCollection<CardTreeViewItem>();
                Chapters.Add(item);
                ++counter;
            }

            counter = 0;
            max = learningModule.Cards.Count;
            foreach (ICard card in learningModule.Cards.Cards)
            {
                context.Post(new SendOrPostCallback(delegate(object state)
                {
                    OnContentLoading(this, new ContentLoadingEventArgs(counter, max, ContentType.Card));
                }), null);

                foreach (ChapterTreeViewItem item in Chapters)
                {
                    if (item.Id == card.Chapter)
                    {
                        item.Cards.Add(new CardTreeViewItem(card, item));
                        break;
                    }
                }
                ++counter;
            }

            context.Post(new SendOrPostCallback(delegate(object state)
            {
                OnContentLoaded(this, EventArgs.Empty);
            }), null);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Selects the card tree view items.
 /// </summary>
 /// <param name="chapterTreeViewItem">The chapter tree view item.</param>
 /// <remarks>Documented by Dev08, 2009-07-15</remarks>
 private void SelectCardTreeViewItems(ChapterTreeViewItem chapterTreeViewItem)
 {
     foreach (CardTreeViewItem cardTreeViewItem in chapterTreeViewItem.Cards)
         cardTreeViewItem.IsChecked = true;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Inverts the selection card tree view items.
 /// </summary>
 /// <param name="chapterTreeViewItem">The chapter tree view item.</param>
 /// <remarks>Documented by Dev08, 2009-07-15</remarks>
 private void InvertSelectionCardTreeViewItems(ChapterTreeViewItem chapterTreeViewItem)
 {
     foreach (CardTreeViewItem cardTreeViewItem in chapterTreeViewItem.Cards)
         cardTreeViewItem.IsChecked = !cardTreeViewItem.IsChecked;
 }