Example #1
0
        With(
            this PaginatorState state,
            params Action <PaginatorState>[] mutators)
        {
            foreach (var item in mutators)
            {
                item(state);
            }

            return(new PaginatorState(state));
        }
        NextState(PaginatorState pPaginatorState)
        {
            var res = pPaginatorState.
                      PipeForward(GetNumberOfPages()).
                      PipeForward(IsValidLeft()).
                      PipeForward(IsValidLeftMore()).
                      PipeForward(IsValidRight()).
                      PipeForward(IsValidRightMore());

            return(res);
        }
        Init(
            IntMore0Less65535Exclsv pCurrentPage,
            IntMore0Less65535Exclsv pItemsPerPage,
            IntMore0Less65535Exclsv pPagesToSkip,
            int pTotalNumberOfItemsInDB
            )
        {
            var res = new PaginatorState();

            res.CurrentPage            = pCurrentPage;
            res.ItemsPerPage           = pItemsPerPage;
            res.PagesToSkip            = pPagesToSkip;
            res.TotalNumberOfItemsInDB = pTotalNumberOfItemsInDB;

            return(NextState(res));
        }
        public PaginatorState(PaginatorState old) : this()
        {
            NumberOfPages          = old.NumberOfPages;
            CurrentPage            = old.CurrentPage;
            ItemsPerPage           = old.ItemsPerPage;
            PagesToSkip            = old.PagesToSkip;
            TotalNumberOfItemsInDB = old.TotalNumberOfItemsInDB;

            IsValidLeft      = old.IsValidLeft;
            IsValidLeftMore  = old.IsValidLeftMore;
            IsValidRight     = old.IsValidRight;
            IsValidRightMore = old.IsValidRightMore;

            PagesToShow    = old.PagesToShow;
            PagesRight     = old.PagesRight;
            PagesRightMore = old.PagesRightMore;
            PagesLeft      = old.PagesLeft;
            PagesLeftMore  = old.PagesLeftMore;
        }
 GoLeftMore(
     this PaginatorState pState)
 {
     return(NextState(pState.With(z => z.CurrentPage.Value -= pState.PagesToSkip.Value)));
 }
 GoLeft(
     this PaginatorState pState)
 {
     return(NextState(pState.With(z => z.CurrentPage.Value--)));
 }
 GoRight(
     this PaginatorState pState)
 {
     return(NextState(pState.With(z => z.CurrentPage.Value++)));
 }