public MenuPageViewModel(int index, Func <IDataSource> getGetDataSource, IConnectionListener connectionListener) { _getDataSource = getGetDataSource; _connectionListener = connectionListener; _connectionListener.Subscribe(this); _categories = new ObservableCollection <GuideCategoryNodeViewModel>(); if (_getDataSource().IsAuthorized) { _recommendedSectionViewModel = new RecommendedSectionViewModel(_getDataSource, connectionListener, this); _subscriptions = new SubscriptionChannelsViewModel(_getDataSource, connectionListener); _history = new HistoryPageViewModel(_getDataSource, connectionListener); _likedViewModel = new LikedViewModel(_getDataSource, connectionListener); _uploadedPageViewModel = new UploadedPageViewModel(_getDataSource, connectionListener); _myPlaylistListViewModel = new MyPlaylistListViewModel(_getDataSource, connectionListener, new NoContextMenuStrategy(), this); } _categoryCommand = new RelayCommand <NavigationObject>(CategoryLoad); SelectedIndex = index; _isConnected = connectionListener.CheckNetworkAvailability(); //App.ViewModel.IndicatorHolder.Subscribe(() => //{ // ProgressIndicator = App.ViewModel.IndicatorHolder.ProgressIndicator; //}); }
private async void SetAuthorizedSelection(int index) { switch (index) { case 0: Debug.WriteLine("Video categories"); await LoadCategories(); break; case 1: Debug.WriteLine("recommended"); if (RecommendedSectionViewModel.Items.Count > 0) { return; } await RecommendedSectionViewModel.FirstLoad(); break; case 2: Debug.WriteLine("subscriptions"); await SubscriptionChannelsViewModel.FirstLoad(); break; case 3: Debug.WriteLine("playlists"); await MyPlaylistListViewModel.FirstLoad(); break; case 4: Debug.WriteLine("liked"); await LikedViewModel.FirstLoad(); break; case 5: Debug.WriteLine("uploaded"); await UploadedPageViewModel.FirstLoad(); break; case 6: Debug.WriteLine("history"); await HistoryPageViewModel.FirstLoad(); break; } }