private async void OnReviewClicked(object sender, RoutedEventArgs e) { // The review page might have to set navigation data (review includes UserStatus). Let's make 100% sure // that the database has correct navigation data set up. Hint: it really should already because if we are // here, then the book has been set to "reading", and that should in turn force navigation data. var bookdb = BookDataContext.Get(); EnsureBookNavigationData(bookdb); var sh = new ContentDialog() { Title = "Review Book", PrimaryButtonText = "OK", }; // Old style: var review = new BookReview(); // This is the edit control, not the UserReview data var review = new ReviewNoteStatusControl(); // This is the edit control, not the UserReview data // Set up the potential note, if that's what the user is going to do. var location = GetCurrBookLocation().ToJson(); string currSelection = ""; if (CurrHtml != null && CurrHtml.Contains("DoGetSelection")) { currSelection = await uiHtml.InvokeScriptAsync("DoGetSelection", null); } var note = new UserNote() { BookId = BookData.BookId, CreateDate = DateTimeOffset.Now, Location = location, Text = currSelection, }; review.SetupNote(note); sh.Content = review; string defaultReviewText = ""; if (CurrHtml != null && CurrHtml.Contains("DoGetSelection")) { defaultReviewText = await uiHtml.InvokeScriptAsync("DoGetSelection", null); } review.SetBookData(BookData, defaultReviewText); var result = await sh.ShowAsync(); switch (result) { case ContentDialogResult.Primary: review.SaveData(); var nav = Navigator.Get(); nav.UpdateProjectRome(ControlId, GetCurrBookLocation()); break; } SetReviewSymbol(); }
/// <summary> /// Handles the entire problem of reviewing each of the selected books. Will pop up a little pop-up /// and let the user do a review of each one. /// </summary> /// <returns></returns> public async Task RunSavedReviewEachBook() { if (SavedSelectedBooks == null) { return; } var selectedBooks = SavedSelectedBooks; var deleteBook = SavedDeleteBook; // Setup to delete all selected books from the Nook EbookReaderProgressControl progress = null; if (deleteBook) { await SetupProgressFolderAsync(); progress = new EbookReaderProgressControl(); uiAlternateContent.Visibility = Visibility.Visible; uiAlternateContent.Children.Clear(); uiAlternateContent.Children.Add(progress); progress.SetNBooks(selectedBooks.Count); } var bookdb = BookDataContext.Get(); var sh = new ContentDialog() { Title = "Review Book", PrimaryButtonText = "OK", SecondaryButtonText = "Cancel", }; var reviewlist = new ReviewNoteStatusListControl(); reviewlist.SetBookList(selectedBooks); sh.Content = reviewlist; var result = await sh.ShowAsync(); ; #if NEVER_EVER_DEFINED // The old code that did a pop-up per book. The new way does one pop-up with a swipable list. foreach (var bookData in selectedBooks) { var srcfullname = bookData.DownloadData.FullFilePath; var fname = bookData.DownloadData.FileName; var nd = CommonQueries.BookNavigationDataEnsure(bookdb, bookData); var sh = new ContentDialog() { Title = "Review Book", PrimaryButtonText = "OK", SecondaryButtonText = "Cancel", }; var review = new ReviewNoteStatusControl(); string defaultReviewText = null; var BookData = bookData; review.SetBookData(BookData, defaultReviewText); sh.Content = review; var result = await sh.ShowAsync(); switch (result) { case ContentDialogResult.Primary: review.SaveData(); bool deleteOk = true; if (progress != null) { deleteOk = await DeleteDownloadedBookAsync(progress, bookData); } var nav = Navigator.Get(); //TODO: setup Rome?? nav.UpdateProjectRome(ControlId, GetCurrBookLocation()); break; } if (deleteBook) { // TODO: How to delete it? ; } } #endif }