public SectionBaseViewModel( Func <IDataSource> getGeDataSource, IConnectionListener connectionListener, IPlaylistsSevice playlistService, Action <bool> changeProgressIndicator = null) : base(getGeDataSource, connectionListener, changeProgressIndicator) { if (getGeDataSource == null) { throw new ArgumentNullException("getGeDataSource"); } if (connectionListener == null) { throw new ArgumentNullException("connectionListener"); } _getDataSource = getGeDataSource; _connectionListener = connectionListener; _connectionListener.Subscribe(this); _playlistService = playlistService; _hasItems = true; _isLargeItems = SettingsHelper.GetIsLargeItems(); _loadMoreCommand = new Common.RelayCommand(LoadMore); _itemClickCommand = new RelayCommand <NavigationObject>(NavigateTo); _selectCommand = new Common.RelayCommand(SelectItems); _deleteCommand = new Common.RelayCommand(DeleteItems); _selectedItems = new ObservableCollection <NodeViewModelBase>(); //_isConnected = connectionListener.CheckNetworkAvailability(); Items = new ObservableCollection <NodeViewModelBase>(); IsItemClickEnabled = true; }
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; //}); }
public ProfileSectionViewModel(Func <IDataSource> getDatasource, IConnectionListener connectionListener) { _getDataSource = getDatasource; _connectionListener = connectionListener; _subscriptionsCommand = new RelayCommand <FrameworkElement>(Subscriptions); _historyCommand = new RelayCommand <FrameworkElement>(GetHistory); _recommendedCommand = new RelayCommand <FrameworkElement>(Recommended); _videoCategoryCommand = new RelayCommand <FrameworkElement>(VideoCategories); _likedCommand = new RelayCommand <FrameworkElement>(Liked); _uploadedCommand = new RelayCommand <FrameworkElement>(Uploaded); _myPlaylistsCommand = new RelayCommand <FrameworkElement>(MyPlaylists); _loginCommand = new Common.RelayCommand(Login); _logoutCommand = new Common.RelayCommand(Logout); _getDataSource().Subscribe(this); _connectionListener.Subscribe(this); _loginStatus = LoginStatus.NotLogged; }
public VideoPageViewModel(string videoId, Func <IDataSource> getDataSource, IConnectionListener connectionListener) { Likes = 0; Dislikes = 0; VideoId = videoId; IsLive = false; _getDataSource = getDataSource; _connectionListener = connectionListener; _connectionListener.Subscribe(this); _channelSubscribers = 0; _channelVideoCount = 0; _qualityConverter = new VideoQuality(); _subscribeCommand = new SubscribeCommand(_getDataSource, () => _channelId, InvalidateCommands); _unsubscribeCommand = new UnsubscribeCommand(_getDataSource, () => _channelId, InvalidateCommands); _likeCommand = new RelayCommand(Like, CanLike); _dislikeCommand = new RelayCommand(Dislike, CanLike); _addFavoritesCommand = new RelayCommand(AddFavorites); _videoQualityCommand = new RelayCommand(ChangeVideoQuality); LoadVideoQualities(); LoadVideoItem(videoId); }