Пример #1
0
        public BookDetailsVM(IWebStoreService webStoreService)
        {
            _webStoreService = webStoreService;

            this.OnRouted((sender, e) =>
            {
                if (!string.IsNullOrEmpty(e.From))
                {
                    // Extract the book title from the route path.
                    var bookTitle = e.From.Replace("book/", "");

                    Book = _webStoreService.GetBookByTitle(bookTitle);
                    Changed(nameof(Book));
                }
            });
        }
Пример #2
0
        public BookDetailsVM(IWebStoreService webStoreService)
        {
            _webStoreService = webStoreService;

            BookDefaultRoute = this.Redirect("examples/bookstore", "default");

            this.OnRouted((sender, e) =>
            {
                if (!string.IsNullOrEmpty(e.From))
                {
                    // Extract the book title from the route path.
                    SearchTitle = e.From.Replace("book/", "");
                    Changed(nameof(SearchTitle));

                    Book = _webStoreService.GetBookByTitle(SearchTitle);
                    Changed(nameof(Book));
                }
            });
        }