protected override async Task<IAsyncEnumerable<VideoInfoControlViewModel>> GetPagedItemsImpl(int head, int count) { VideoListingResponse res = null; if (SearchOption.SearchTarget == SearchTarget.Keyword) { res = await SearchProvider.GetKeywordSearch(SearchOption.Keyword, (uint)head, (uint)count, SearchOption.Sort, SearchOption.Order); } else if (SearchOption.SearchTarget == SearchTarget.Tag) { res = await SearchProvider.GetTagSearch(SearchOption.Keyword, (uint)head, (uint)count, SearchOption.Sort, SearchOption.Order); } if (res == null || res.VideoInfoItems == null) { return AsyncEnumerable.Empty<VideoInfoControlViewModel>(); } else { return res.VideoInfoItems.Where(x => x != null).Select(item => { var vm = new VideoInfoControlViewModel(item.Video.Id); vm.SetupDisplay(item); return vm; }) .ToAsyncEnumerable(); } }
protected override async Task<int> ResetSourceImpl() { int totalCount = 0; if (SearchOption.SearchTarget == SearchTarget.Keyword) { var res = await SearchProvider.GetKeywordSearch(SearchOption.Keyword, 0, 2, SearchOption.Sort, SearchOption.Order); totalCount = (int)res.GetTotalCount(); } else if (SearchOption.SearchTarget == SearchTarget.Tag) { var res = await SearchProvider.GetTagSearch(SearchOption.Keyword, 0, 2, SearchOption.Sort, SearchOption.Order); totalCount = (int)res.GetTotalCount(); } return totalCount; }