Пример #1
0
        public void Update(string region, string quality)
        {
            _region  = region;
            _quality = _qualityHelper.GetQualityEnum(quality);
            _categories.Clear();
            _guideCategories.Clear();
            _channels.Clear();

            _settingsNotifier.Notify(new UpdateSettingsEventArgs());
        }
Пример #2
0
 public DataSource(IRemoteDataSource remoteDataSource, string region, int maxPageResult, string quality)
 {
     _remoteDataSource = remoteDataSource;
     _categories       = new List <IVideoCategory>();
     _guideCategories  = new List <IGuideCategory>();
     _channels         = new List <IChannel>();
     _region           = region.ToUpper();
     _maxPageResult    = maxPageResult;
     _qualityHelper    = new VideoQuality();
     _quality          = _qualityHelper.GetQualityEnum(quality);
 }
        private async void LoadVideoItem(string videoId)
        {
            RelatedVideosViewModel = new RelatedVideosViewModel(videoId, _getDataSource, _connectionListener, this);
            CommentsViewModel      = new CommentsViewModel(videoId, _getDataSource, _connectionListener);

            var videoItem = await _getDataSource().GetVideoItem(videoId);

            if (videoItem == null)
            {
                return;
            }

            SetChannelInfo(videoItem.ChannelId);

            LayoutHelper.InvokeFromUiThread(() =>
            {
                if (!_connectionListener.CheckNetworkAvailability())
                {
                    return;
                }

                if (videoItem.Details != null)
                {
                    Title       = videoItem.Details.Title;
                    Description = videoItem.Details.Description;
                    Duration    = videoItem.Details.Duration;
                    ViewCount   = videoItem.Details.Statistics.ViewCount;
                    SetLikesAndDislikes(videoItem.Details.Statistics);
                    IsLive = videoItem.Details.IsLive;
                }

                if (videoItem.Thumbnails != null)
                {
                    ImagePath = videoItem.Thumbnails.GetThumbnailUrl();
                }

                if (videoItem.PublishedAt != null)
                {
                    PublishedAt = videoItem.PublishedAt.Value.ToString("D");
                }

                SetVideoRating(videoId);
                var defaultQuality = SettingsHelper.GetQuality();
                var quality        = _qualityConverter.GetQualityEnum(defaultQuality);
                SetVideoUri(videoId, quality, IsLive);
            });
        }