public void FirstPage() { CurrentPage = 1; int maxNum = Total >= MaxSize ? MaxSize : Total; var list = Source?.Take(maxNum); PagePagingEvent?.Invoke(list, CurrentPage, TotalPage); }
private void PagingModel_PagePagingEvent(IEnumerable <ProgramViewModel> arg1, int arg2, int arg3) { this.ProgramList.Clear(); arg1.ToList().ForEach(d => ProgramList.Add(d)); CurrentPage = arg2; TotalPage = arg3; PagePagingEvent?.Invoke(); }
public void LinkPage(int pageIndex) { if (pageIndex > TotalPage) { pageIndex = TotalPage; } CurrentPage = pageIndex; int maxNum = CurrentPage < TotalPage ? MaxSize : Total - (CurrentPage - 1) * MaxSize; var list = Source.Skip((CurrentPage - 1) * MaxSize).Take(maxNum); PagePagingEvent?.Invoke(list, CurrentPage, TotalPage); }
public bool PrePage() { if (CurrentPage <= 1) { return(false); } var list = Source.Skip((CurrentPage - 1) * MaxSize).Take(MaxSize); CurrentPage--; PagePagingEvent?.Invoke(list, CurrentPage, TotalPage); return(true); }
public bool NextPage() { if (CurrentPage >= TotalPage) { return(false); } CurrentPage++; int maxNum = CurrentPage < TotalPage ? MaxSize : Total - (CurrentPage - 1) * MaxSize; var list = Source.Skip((CurrentPage - 1) * MaxSize).Take(maxNum); PagePagingEvent?.Invoke(list, CurrentPage, TotalPage); return(true); }