internal MoviesIncrementalLoadingCollection(Surrogate surrogate) { foreach (var moviePartial in surrogate.Items) { Add(moviePartial); } _request = surrogate.Request; _currentResponse = surrogate.CurrentResponse; _maxCount = surrogate.CurrentResponse?.Data?.MovieCount ?? -1; }
protected override async Task <IList <YtsMoviePartial> > LoadMoreItemsOverrideAsync(CancellationToken c, uint count) { var page = _currentResponse?.Data.PageNumber + 1 ?? 1; var response = await _request.Page(page).ToResponseAsync(); if (!response.IsSuccessStatusCode) { return(null); } _currentResponse = response.DeserializedResponse; _maxCount = _currentResponse.Data.MovieCount; return(_currentResponse.Data.Movies); }