示例#1
0
        private void InitializeCommands()
        {
            SelectPageCommand = ReactiveCommand.Create <AppStorePageViewModel>(selectedPage =>
            {
                if (selectedPage != null)
                {
                    CurrentPage = selectedPage;
                }
            });

            PreviousPageCommand = ReactiveCommand.Create(() =>
            {
                if (CurrentPage != null)
                {
                    SetPage(CurrentPage.PageNumber - 1);
                }
            });

            NextPageCommand = ReactiveCommand.Create(() =>
            {
                if (CurrentPage != null)
                {
                    SetPage(CurrentPage.PageNumber + 1);
                }
            });

            SearchCommand = ReactiveCommand.Create(() =>
            {
                if (AppStoreViewModel != null)
                {
                    AppStoreViewModel.Search(SearchText);
                }
            });
        }
示例#2
0
        private void InitializeObservables()
        {
            this.ObservableForProperty(x => x.AppStoreType).Subscribe(x => Load());
            this.ObservableForProperty(x => x.CurrentPage).Subscribe(x =>
            {
                if (AppStoreViewModel != null && CurrentPage != null)
                {
                    AppStoreViewModel.Refresh(CurrentPage.PageNumber);
                }
            });

            Observable.FromEventPattern <NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs>(
                h => Pages.CollectionChanged += h,
                h => Pages.CollectionChanged -= h).Subscribe(x =>
            {
                this.RaisePropertyChanged(nameof(IsPagesVisible));
            });
        }