Beispiel #1
0
        public PostsPageViewModel(INavigationService navigationService, IRedditApiSource redditApiSource)
        {
            _navigationService = navigationService;
            _redditApiSource   = redditApiSource;

            ShowPostDetailCommand = new DelegateCommand <Post>(async(post) =>
            {
                var navParams = new NavigationParameters
                {
                    { "currentPost", post }
                };

                await navigationService.NavigateAsync(PageTokens.PostDetailPage, navParams);
            });
        }
        public RootMasterDetailPageViewModel(INavigationService navigationService, IRedditApiSource redditApiSource)
        {
            _navigationService = navigationService;
            _redditApiSource   = redditApiSource;

            ChangeSubredditCommand = DelegateCommand <Subreddit> .FromAsyncHandler(async (subReddit) =>
            {
                var navParams = new NavigationParameters
                {
                    { "currentSubreddit", subReddit }
                };
                CurrentSubreddit = subReddit;
                await _navigationService.NavigateAsync($"{PageTokens.RootNavigationPage}/{PageTokens.PostsPage}", navParams);
                // or
                //await _navigationService.NavigateAsync($"{PageTokens.RootNavigationPage}/{PageTokens.PostsPage}?subredditTitle={subReddit.Title}");
            });
        }
Beispiel #3
0
 public PostDetailPageViewModel(INavigationService navigationService, IRedditApiSource redditApiSource)
 {
     _navigationService = navigationService;
     _redditApiSource   = redditApiSource;
 }