/// <summary> /// Load more short review /// </summary> /// <returns></returns> private async Task loadMoreShortReview() { if (!shortReviewParser.hasMoreReview) { noShortReviewTextBlock.Visibility = System.Windows.Visibility.Visible; await Task.Delay(2000); noShortReviewTextBlock.Visibility = System.Windows.Visibility.Collapsed; } else { bool fromDormant = false; ShortReviewProgressBar.IsIndeterminate = true; ShortReviewProgressBar.Visibility = System.Windows.Visibility.Visible; shortReviewNewLoad = true; try { await shortReviewParser.loadMore(); ShortReviewProgressBar.Visibility = System.Windows.Visibility.Collapsed; } catch (TaskCanceledException) { if (App.isFromDormant) { fromDormant = true; } else { ShortReviewProgressBar.Visibility = System.Windows.Visibility.Collapsed; if (!shortReviewParser.isCanceled()) { MessageBoxResult result = MessageBox.Show(AppResources.ConnectionError, "", MessageBoxButton.OK); } } } catch (Exception) { if (App.isFromDormant) { fromDormant = true; } else { ShortReviewProgressBar.Visibility = System.Windows.Visibility.Collapsed; MessageBoxResult result = MessageBox.Show(AppResources.ConnectionError, "", MessageBoxButton.OK); } } if (fromDormant) { App.isFromDormant = false; await loadMoreShortReview(); } } }
private void loadMoreButton_Click(object sender, RoutedEventArgs e) { if (shortReviewParser != null && movie != null) { loadMoreButton.IsEnabled = false; ShortReviewProgressBar.IsIndeterminate = true; ShortReviewProgressBar.Visibility = System.Windows.Visibility.Visible; shortReviewParser.loadMore(); } }