/// <summary>
 /// Standard WP7 method which is running always when user navigates to page.
 /// </summary>
 /// <param name="e">NavigationService argument</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (_isNewInstance)
     {
         String categoryName = String.Empty;
         if (NavigationContext.QueryString.TryGetValue("CategoryName", out categoryName))
         {
             _category = App.AppDictionary["SentCategory"] as NormalCategory;
             if (_category != null)
             {
                 if (!_category.Visited)
                 {
                     _category.Visited = true;
                 }
                 SubSategoryName.Text = _category.Name;
                 CategoryName.Text    = categoryName;
                 NormalCategoryViewModel normalCategoryViewModel = new NormalCategoryViewModel(_category);
                 normalCategoryViewModel.AddQuestionsToListBox(QuestionsList);
             }
             else
             {
                 _backPreesed = true;
                 NavigationService.GoBack();
             }
         }
         _isNewInstance = false;
     }
 }
Beispiel #2
0
        /// <summary>
        /// Constuctor which initializes component on page (each category on seperate page).
        /// </summary>
        /// <param name="category">Contains information about category (e.g. category ID, suvery ID, etc.)</param>
        public CategoryPivotItem(Category category)
        {
            _category = category;
            if (_category is NormalCategory)
            {
                CategoryControl         categoryControl         = new CategoryControl();
                NormalCategoryViewModel normalCategoryViewModel = new NormalCategoryViewModel(((NormalCategory)_category));
                normalCategoryViewModel.AddQuestionsToListBox(categoryControl.QuestionsList);

                Header  = ((NormalCategory)_category).Name;
                Content = categoryControl;
            }
            else if (_category is ConditionCategory)
            {
                ConditionCategoryControl categoryControl = new ConditionCategoryControl();

                categoryControl.DataContext = new ConditionCategoryControlViewModel((ConditionCategory)_category);

                Header  = category.Name;
                Content = categoryControl;
            }
        }