Exemplo n.º 1
0
        public NavigatorViewModel(IObservable <int> currentPage, IObservable <int> pageSize)
        {
            Size = new ReactiveProperty <int>(pageSize);

            var obs = currentPage.DistinctUntilChanged().CombineLatest(Size, (a, b) =>
                                                                       new { page = a, size = b });

            Output = NextCommand.WithLatestFrom(obs, (a, b) => new PageRequest(b.page + 1, b.size)).Merge
                         (PreviousCommand.WithLatestFrom(obs, (a, b) =>
                                                         new PageRequest(b.page - 1, b.size))).StartWith(new PageRequest(1, 25)).ToReactiveProperty();
        }