private async Task <ResultData <T> > GetIncrementalListData(int pageIndex) { IEnumerable <T> newList = new List <T>(); bool HasMoreItems = false; try { var respList = await GetList(pageIndex); newList = respList; if (newList == null || newList.Count() == 0) { HasMoreItems = false; } else if (newList.Count() > 0) { HasMoreItems = true; } await CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { OnHasMoreItemChanged?.Invoke(HasMoreItems); LoadMoreItemCompleted(newList, pageIndex); }); } catch (Exception e) { var task = ExceptionHelper.WriteRecordAsync(e, nameof(DataViewModelBase <T>), nameof(GetIncrementalListData)); } return(new ResultData <T>() { Data = newList, HasMoreItems = HasMoreItems }); }
private async Task <ResultData <T> > GetIncrementalListData(int pageIndex) { IEnumerable <T> newList = new List <T>(); bool HasMoreItems = false; try { newList = await GetList(pageIndex); if (newList == null || newList.Count() == 0) { HasMoreItems = false; } else if (newList.Count() > 0) { HasMoreItems = true; } await CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { if (pageIndex == DEFAULT_PAGE_INDEX) { DataList.Clear(); } OnHasMoreItemChanged?.Invoke(HasMoreItems); LoadMoreItemCompleted(newList, pageIndex); }); } catch (Exception e) { var task = Logger.LogAsync(e); } return(new ResultData <T>() { Data = newList, HasMoreItems = HasMoreItems }); }