Example #1
0
 public void Reset()
 {
     TotalCount           = 0;
     PaggingChangeHandler = null;
     TotalPage            = 0;
     CurrentPage          = 1;
     PageSize             = DEFAULT_PAGE_SIZE;
 }
Example #2
0
 public void Init(int totalCount, PaggingChangeCallBack handler)
 {
     if (totalCount < 0)
     {
         throw new UserFriendlyException($"分页数据异常,总数据量不能小于0");
     }
     TotalCount           = totalCount;
     PaggingChangeHandler = handler;
     TotalPage            = DataHelper.Ceil((totalCount / (double)PageSize));
 }
Example #3
0
        public PaggingViewMode(IEnumerable <T> sourceData, int totalCount = -1, PaggingChangeCallBack handler = null)
        {
            _currentPage = 1;
            // FIXME: pagesize绑定未实现。
            _pageSize = DEFAULT_PAGE_SIZE;

            FirstPageCommand      = new DelegateCommand(FirstPageAction);
            PreviousPageCommand   = new DelegateCommand(PreviousPageAction);
            NextPageCommand       = new DelegateCommand(NextPageAction);
            LastPageCommand       = new DelegateCommand(LastPageAction);
            PageSizeChangeCommand = new DelegateCommand(PageSizeChangeAction);

            PaggingChangeHandler = handler;

            if (-1 == totalCount)
            {
                totalCount = sourceData.Count();
            }

            _source    = sourceData;
            _totalPage = DataHelper.Ceil((totalCount / (double)_pageSize));
            _fakeSoruce.Clear();
            _fakeSoruce.AddRange(_source.Take(_pageSize).ToList());
        }