Exemple #1
0
        /// <summary>
        /// Load review
        /// </summary>
        /// <returns></returns>
        private async Task loadReview()
        {
            if (movie != null)
            {
                bool fromDormant = false;
                reviewParser = new ReviewParser(movie);
                ReviewProgressBar.IsIndeterminate = true;
                ReviewProgressBar.Visibility      = System.Windows.Visibility.Visible;
                reviewNewLoad = true;

                try
                {
                    await reviewParser.getReview();

                    reviewLongListSelector.ItemsSource = reviewParser.reviewCollection;
                    if (reviewLongListSelector.ItemsSource.Count == 0)
                    {
                        reviewTextBlock.Visibility = System.Windows.Visibility.Visible;
                    }
                    ReviewProgressBar.Visibility = System.Windows.Visibility.Collapsed;
                }
                catch (TaskCanceledException)
                {
                    if (App.isFromDormant)
                    {
                        fromDormant = true;
                    }
                    else
                    {
                        ReviewProgressBar.Visibility = System.Windows.Visibility.Collapsed;
                        if (!reviewParser.isCanceled())
                        {
                            reviewLoaded = false;
                            MessageBoxResult result = MessageBox.Show(AppResources.ConnectionError, "", MessageBoxButton.OK);
                        }
                    }
                }
                catch (Exception)
                {
                    if (App.isFromDormant)
                    {
                        fromDormant = true;
                    }
                    else
                    {
                        reviewLoaded = false;
                        ReviewProgressBar.Visibility = System.Windows.Visibility.Collapsed;
                        MessageBoxResult result = MessageBox.Show(AppResources.ConnectionError, "", MessageBoxButton.OK);
                    }
                }

                if (fromDormant)
                {
                    App.isFromDormant = false;
                    await loadReview();
                }
            }
        }
Exemple #2
0
 private void loadReview()
 {
     if (movie != null)
     {
         loadMoreReviewButton.IsEnabled = false;
         reviewParser                       = new ReviewParser(movie);
         reviewParser.progressBar           = ReviewProgressBar;
         reviewParser.button                = loadMoreReviewButton;
         reviewParser.text                  = loadReviewText;
         reviewLongListSelector.ItemsSource = reviewParser.reviewCollection;
         ReviewProgressBar.IsIndeterminate  = true;
         ReviewProgressBar.Visibility       = System.Windows.Visibility.Visible;
         reviewParser.parseReview();
     }
 }
 public ReviewManager(OtsService otsService, ReviewParser reviewParser)
 {
     _otsService   = otsService;
     _reviewParser = reviewParser;
 }