Exemplo n.º 1
0
        /// <summary>
        /// Handles the changing of tabs in the tabbedPage
        /// </summary>
        /// <param name="e"> Index of the tab selected </param>
        void HandlePageChanged(object e)
        {
            if (e.GetType() != typeof(NavigationPage))
            {
                return; // e is not a NavigationPage, no need to handle
            }

            NavigationPage selectedPage = (NavigationPage)e;

            if (selectedPage.Title.Equals(HomePageTitle))
            {
                AttachedDepartmentListVM = new DepartmentListViewModel(CurrHttpConnection);
                AttachedDepartmentListVM.GenerateDepartmentList();
                selectedPage.BindingContext = AttachedDepartmentListVM;
                selectedPage.Title          = HomePageTitle; // Binding context changed, need to reset the title
            }
            else if (selectedPage.Title.Equals(ReviewPageTitle))
            {
                AttachedCourseReviewVM      = new CourseReviewViewModel(CurrHttpConnection);
                selectedPage.BindingContext = AttachedCourseReviewVM;
                selectedPage.Title          = ReviewPageTitle; //Binding context changed, need to reset the title
            }
            else if (selectedPage.Title.Equals(RecommendationsPageTitle))
            {
                AttachedRecommendationVM = new CourseRecommendationsViewModel(CurrHttpConnection);
                AttachedRecommendationVM.GenerateRecommendationsList();
                selectedPage.BindingContext = AttachedRecommendationVM;
                selectedPage.Title          = RecommendationsPageTitle; //Binding context changed, need to reset the title
            }
        }
Exemplo n.º 2
0
 public HomePageViewModel(ISimpliPassHttpConnection argHttpConnection)
 {
     PageChangedCommand       = new Command(HandlePageChanged);
     TabbedPageChangedCommand = new Command(ResetTabbedPageProperties);
     CurrHttpConnection       = argHttpConnection;
     AttachedDepartmentListVM = new DepartmentListViewModel(CurrHttpConnection);
     AttachedRecommendationVM = new CourseRecommendationsViewModel(CurrHttpConnection);
     AttachedCourseReviewVM   = new CourseReviewViewModel(CurrHttpConnection);
 }