示例#1
0
        public async Task <IEnumerable <Article> > GetPagedItemsAsync(int pageIndex, int pageSize, CancellationToken cancellationToken = new CancellationToken())
        {
            using (pageIndex == 0 ? _progressService.BeginUiOperation(true) : _progressService.BeginBackgroundOperation(true))
            {
                try
                {
                    var paginationResponse = await FuncEx.Make(() => _shopApiService.GetArticles(new PaginationRequest <ArticlesSearchRequest>
                    {
                        Page     = pageIndex + 1,
                        PageSize = pageSize,
                        Request  = _searchRequest
                    })
                                                               ).RetryWhenException <PaginationResponse <Article>, ApiException>().ConfigureAwait(false);

                    return(paginationResponse.Content);
                }
                catch (ApiException e)
                {
                    Logger.Error($"Failed to load article items. Page {pageIndex}, pageSize {pageSize}", e);
                    throw;
                }
            }
        }