private async void LoadVideos(string userId) { var muchos = await _ytManager.GetChannelIdAsync(userId); var filmiki = await _ytManager.GetVideosFromChannelAsync(muchos); // New colletion YtVideos.Clear(); List <YTVideo> xx = new List <YTVideo>(); foreach (SearchResult searchResult in filmiki) { var tmpobj = new YTVideo() { videoId = searchResult.Id.VideoId, channelId = searchResult.Snippet.ChannelId, publishDdate = searchResult.Snippet.PublishedAt ?? new DateTime(1900, 1, 1), title = searchResult.Snippet.Title, thumbnail = searchResult.Snippet.Thumbnails.Default__?.Url ?? "empty" }; YtVideos.Add(tmpobj); } }
private async void LoadVideos(string userId, string channelId) { List <SearchResult> filmiki; var muchos = await _ytManager.GetChannelIdForUserAsync(userId); if (!ReferenceEquals(muchos, null)) { filmiki = await _ytManager.GetVideosFromChannelAsync(muchos); } else { filmiki = await _ytManager.GetVideosFromChannelAsync(channelId); } if (ReferenceEquals(filmiki, null)) { return; } // New colletion YtVideos.Clear(); List <YTVideo> xx = new List <YTVideo>(); Random rnd = new Random(); foreach (SearchResult searchResult in filmiki) { var tmpobj = new YTVideo() { videoId = searchResult.Id.VideoId, channelId = searchResult.Snippet.ChannelId, publishDdate = searchResult.Snippet.PublishedAt ?? new DateTime(1900, 1, 1), title = searchResult.Snippet.Title, thumbnail = searchResult.Snippet.Thumbnails.Default__?.Url ?? "empty", description = searchResult.Snippet.Description, rating = rnd.Next(0, 5), // creates a number between 1 and 6 isAvailableOffline = true, category = "default" }; YtVideos.Add(tmpobj); } }