Пример #1
0
 public PlaylistListViewModel(string channelId, Func <IDataSource> getGeDataSource,
                              IConnectionListener connectionListener, IContextMenuStrategy contextMenuStrategy, Action <bool> changeProgressIndicator = null)
     : base(getGeDataSource, connectionListener, null, changeProgressIndicator)
 {
     _channelId           = channelId;
     _contextMenuStrategy = contextMenuStrategy;
 }
 public ChannelNodeViewModel(IChannel channel, IDataSource dataSource, IContextMenuStrategy menuProvider = null) : base(dataSource, menuProvider, false)
 {
     _channel = channel;
     Title    = channel.Title;
     _id      = channel.Id;
     Image    = channel.Thumbnails.GetThumbnailUrl();
 }
        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;
        }
Пример #4
0
 public PlayListItemNodeViewModel(IPlayListItem item, IDataSource dataSource,
                                  Func <Task> delete, IContextMenuStrategy menuProvider, bool isLargeItems)
     : base(dataSource, menuProvider, isLargeItems)
 {
     PlayListItem   = item;
     _id            = item.Id;
     _videoId       = item.ContentDetails.VideoId;
     Title          = item.Snippet.Title;
     Description    = item.Snippet.Description;
     ImagePath      = item.Snippet.Thumbnails.GetThumbnailUrl();
     PublishedAt    = item.Snippet.PublishedAt;
     Duration       = null;
     _delete        = delete;
     _deleteCommand = new RelayCommand(Delete);
     IsContexMenu   = !(menuProvider is NoContextMenuStrategy);
 }
        public PlaylistNodeViewModel(IPlaylist item, IDataSource dataSource, IContextMenuStrategy menu, DeleteDelegate delete, bool isLargeItems)
            : base(dataSource, menu, isLargeItems)
        {
            _delete        = delete;
            _deleteCommand = new RelayCommand(Delete);

            _id = item.Id;
            if (item.Snippet != null)
            {
                Title       = item.Snippet.Title;
                ImagePath   = item.Snippet.Thumbnails.GetThumbnailUrl();
                PublishedAt = item.Snippet.PublishedAt;
            }
            if (item.ContentDetails == null)
            {
                return;
            }

            ItemsCount = item.ContentDetails.ItemCount;
        }
Пример #6
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);
                });
            }
        }
Пример #7
0
        public CommentNodeViewModel(IComment comment, Func <IDataSource> getDatasource, IConnectionListener connectionListener, IContextMenuStrategy menuProvider = null) : base(getDatasource(), menuProvider, false)
        {
            TextDisplay           = comment.TextDisplay;
            AuthorDisplayName     = comment.AuthorDisplayName;
            AuthorProfileImageUrl = comment.AuthorProfileImageUrl;
            AuthorChannelId       = comment.AuthorChannelId;
            LikeCount             = comment.LikeCount;
            PublishedAt           = comment.PublishedAt;
            PublishedAtRaw        = comment.PublishedAtRaw;
            ReplayComments        = comment.ReplayComments.Select(c => new CommentNodeViewModel(c, getDatasource, _connectionListener, menuProvider));
            IsReplay = comment.IsReplay;

            _getDatasource      = getDatasource;
            _connectionListener = connectionListener;
            _channelCommand     = new RelayCommand <string>(LoadChannel);
        }
 public MyPlaylistListViewModel(Func <IDataSource> getGeDataSource, IConnectionListener connectionListener,
                                IContextMenuStrategy contextMenuStrategy, IPlaylistsChangeHandler playlistsChangeHandler, Action <bool> changeProgressIndicator = null)
     : base(null, getGeDataSource, connectionListener, contextMenuStrategy, changeProgressIndicator)
 {
     _playlistsChangeHandler = playlistsChangeHandler;
 }
Пример #9
0
 public GuideCategoryNodeViewModel(IGuideCategory category, IDataSource dataSource, IContextMenuStrategy menuProvider = null) : base(dataSource, menuProvider, false)
 {
     Title      = category.Title;
     CategoryId = category.Id;
     ChannelId  = category.ChannelId;
 }
 public SubscriptionNodeViewModel(ISubscription subscription, IDataSource dataSource, IContextMenuStrategy menuProvider = null) : base(dataSource, menuProvider, false)
 {
     _subscription = subscription;
     Title         = subscription.Title;
     _id           = subscription.ChannelId;
     Image         = subscription.Thumbnails.GetThumbnailUrl();
 }