/// The methods provided in this section are simply used to allow /// NavigationHelper to respond to the page's navigation methods. /// /// Page specific logic should be placed in event handlers for the /// <see cref="GridCS.Common.NavigationHelper.LoadState"/> /// and <see cref="GridCS.Common.NavigationHelper.SaveState"/>. /// The navigation parameter is available in the LoadState method /// in addition to page state preserved during an earlier session. protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is ReviewViewModel) { bookViewModel = (e.Parameter as ReviewViewModel).Book; bookViewModel.LoadFullData(); } else if (e.Parameter is BookViewModel) { bookViewModel = e.Parameter as BookViewModel; bookViewModel.LoadFullData(); } else if (e.Parameter is String) { bookViewModel = new BookViewModel(e.Parameter as string); //bookViewModel.LoadFullData(e.Parameter as string); } pageTitle.DataContext = bookViewModel; BookPanel.DataContext = bookViewModel; DescriptionPanel.DataContext = bookViewModel; ReviewPanel.DataContext = bookViewModel; navigationHelper.OnNavigatedTo(e); }
public async void ToggleDetailsClick() { if (!TargetIsBook) return; DetailsVisibility = detailsVisibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed; if (update.Type == "review" && update.Object != null && update.Object.Book != null) book = new BookViewModel(await _gr.GetBookInfo(update.Object.Book.Id)); if (update.Type == "readstatus" && update.Object != null && update.Object.Read_status != null && update.Object.Read_status.Review != null && update.Object.Read_status.Review.Book != null) book = new BookViewModel(await _gr.GetBookInfo(update.Object.Read_status.Review.Book.Id)); NotifyPropertyChanged("Book"); //book = new BookViewModel( await _gr.GetBookInfo(BookId)); //NotifyPropertyChanged("Book"); NotifyPropertyChanged("BookTitle"); NotifyPropertyChanged("BookAuthor"); NotifyPropertyChanged("BookCoverImageURL"); NotifyPropertyChanged("Shelves"); }
public UpdateViewModel(Update update) { this.update = update; if (TargetIsBook) { if (update.Type == "review" && update.Object != null && update.Object.Book != null) book = new BookViewModel(update.Object.Book); if (update.Type == "readstatus" && update.Object != null && update.Object.Read_status != null && update.Object.Read_status.Review != null && update.Object.Read_status.Review.Book != null) book = new BookViewModel(update.Object.Read_status.Review.Book); NotifyPropertyChanged("Book"); } UserClickCommand = new RelayCommand(UserClick); WriteCommentCommand = new RelayCommand(WriteCommentClick); PostCommentCommand = new RelayCommand(PostCommentClick); ToggleDetailsCommand = new RelayCommand(ToggleDetailsClick); LikeCommand = new RelayCommand(LikeClick); //WantToReadCommand = new RelayCommand(WantToReadClick); AddToShelfCommand = new RelayCommand<object>(AddToShelfClick); }
public ReviewViewModel(Review review) { this.review = review; this.book = new BookViewModel(review.Book); }