Ejemplo n.º 1
0
        /// <summary>
        /// Adds all questions in category to pivot page. Each caterogy will be in seperate pivot.
        /// </summary>
        /// <param name="pivot">Pivot name to which categories should be added.</param>
        public void AddCategoriesToPivot(Pivot pivot)
        {
            foreach (Category cat in Survey.Categories)
            {
                if (cat is NormalCategory)
                {
                    CategoryControl          categoryControl         = new CategoryControl();
                    PreviewCategoryViewModel normalCategoryViewModel = new PreviewCategoryViewModel(((NormalCategory)cat));
                    normalCategoryViewModel.AddQuestionsToListBox(categoryControl.QuestionsList);

                    PivotItem item = new PivotItem();
                    item.Header  = ((NormalCategory)cat).Name;
                    item.Content = categoryControl;
                    pivot.Items.Add(item);
                }
                else if (cat is ConditionCategory)
                {
                    ConditionCategory            category        = (ConditionCategory)cat;
                    PreviewConditionCategoryPage categoryControl = new PreviewConditionCategoryPage();

                    categoryControl.DataContext = category;

                    PivotItem item = new PivotItem();
                    item.Header  = category.Name;
                    item.Content = categoryControl;
                    pivot.Items.Add(item);
                }
            }
            Survey.RefreshQuestionsVisibility();
        }
        /// <summary>
        /// Adds all questions in category to pivot page. Each caterogy will be in seperate pivot.
        /// </summary>
        /// <param name="pivot">Pivot name to which categories should be added.</param>
        public void AddCategoriesToPivot(Pivot pivot)
        {
            foreach (Category cat in Survey.Categories)
            {
                if (cat is NormalCategory)
                {
                    CategoryControl categoryControl = new CategoryControl();
                    PreviewCategoryViewModel normalCategoryViewModel = new PreviewCategoryViewModel(((NormalCategory)cat));
                    normalCategoryViewModel.AddQuestionsToListBox(categoryControl.QuestionsList);

                    PivotItem item = new PivotItem();
                    item.Header = ((NormalCategory)cat).Name;
                    item.Content = categoryControl;
                    pivot.Items.Add(item);
                }
                else if (cat is ConditionCategory)
                {
                    ConditionCategory category = (ConditionCategory)cat;
                    PreviewConditionCategoryPage categoryControl = new PreviewConditionCategoryPage();

                    categoryControl.DataContext = category;

                    PivotItem item = new PivotItem();
                    item.Header = category.Name;
                    item.Content = categoryControl;
                    pivot.Items.Add(item);
                }
            }
            Survey.RefreshQuestionsVisibility();
        }