Beispiel #1
0
        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;
        }
        protected NodeViewModelBase(IDataSource dataSource, IContextMenuStrategy menu, bool isLargeItems, IPlaylistsSevice playlistService = null)
        {
            if (menu == null)
            {
                MenuProvider = new NoContextMenuStrategy();
            }

            _dataSource           = dataSource;
            MenuProvider          = menu;
            _playlistService      = playlistService;
            _addToPlayListCommand = new RelayCommand <object>(AddToPlayList);

            IsLargeItems = isLargeItems;
        }
Beispiel #3
0
        public VideoItemViewModel(IVideoItem videoItem, IDataSource dataSource,
                                  IContextMenuStrategy menuProvider, IPlaylistsSevice playlistService, bool isLargeItems) : base(dataSource, menuProvider, isLargeItems, playlistService)
        {
            VideoItem    = videoItem;
            _videoId     = videoItem.Details.VideoId;
            _id          = Guid.NewGuid().ToString();
            Title        = videoItem.Details.Title;
            ChannelTitle = videoItem.ChannelTitle;
            Description  = videoItem.Details.Description;
            ImagePath    = videoItem.Thumbnails.GetThumbnailUrl();
            Duration     = videoItem.Details.Duration;
            ViewCount    = videoItem.Details.Statistics.ViewCount;
            PublishedAt  = videoItem.PublishedAt;
            IsContexMenu = dataSource.IsAuthorized;
            IsLive       = videoItem.Details.IsLive;

            if (isLargeItems)
            {
                LayoutHelper.InvokeFromUiThread(async() =>
                {
                    ChannelLogo = await _dataSource.GetChannelLogo(videoItem.ChannelId);
                });
            }
        }
 public MostPopularViewModel(Func <IDataSource> geDataSource, IConnectionListener connectionListener, IPlaylistsSevice playlistService)
     : base(geDataSource, connectionListener, playlistService)
 {
     ShowAdv = SettingsHelper.IsAdvVisible;
 }
 public MostPopularViewModel(IVideoList videoList, Func <IDataSource> geDataSource, IConnectionListener connectionListener, IPlaylistsSevice playlistService)
     : base(geDataSource, connectionListener, playlistService)
 {
     _videoList = videoList;
     _uniqueId  = videoList.GetHashCode().ToString();
     ShowAdv    = SettingsHelper.IsAdvVisible;
 }
 public SearchVideoViewModel(Func <IDataSource> geDataSource, IConnectionListener connectionListener,
                             Action <bool> changeProgressIndicator, IPlaylistsSevice playlistService)
     : base(SearchType.Video, geDataSource, connectionListener, changeProgressIndicator)
 {
     _playlistService = playlistService;
 }
        public RelatedVideosViewModel(string videoId, Func <IDataSource> geDataSource, IConnectionListener connectionListener, IPlaylistsSevice playlistService)
            : base(geDataSource, connectionListener, playlistService)
        {
            if (videoId == null)
            {
                return;
            }

            _videoId = videoId;
        }
 public RecommendedSectionViewModel(Func <IDataSource> geDataSource, IConnectionListener connectionListener, IPlaylistsSevice playlistService)
     : base(geDataSource, connectionListener, playlistService)
 {
 }