예제 #1
0
        private async Task loadMoreImage()
        {
            if (!imageParser.hasMore)
            {
                noImageTextBlock.Visibility = System.Windows.Visibility.Visible;
                await Task.Delay(2000);

                noImageTextBlock.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                bool fromDormant = false;
                ImageProgressBar.IsIndeterminate = true;
                ImageProgressBar.Visibility      = System.Windows.Visibility.Visible;
                imageNewLoad = true;

                try
                {
                    await imageParser.loadMore();

                    ImageProgressBar.Visibility = System.Windows.Visibility.Collapsed;
                }
                catch (TaskCanceledException)
                {
                    if (App.isFromDormant)
                    {
                        fromDormant = true;
                    }
                    else
                    {
                        ImageProgressBar.Visibility = System.Windows.Visibility.Collapsed;
                        if (!imageParser.isCanceled())
                        {
                            MessageBoxResult result = MessageBox.Show(AppResources.ConnectionError, "", MessageBoxButton.OK);
                        }
                    }
                }
                catch (Exception)
                {
                    if (App.isFromDormant)
                    {
                        fromDormant = true;
                    }
                    else
                    {
                        ImageProgressBar.Visibility = System.Windows.Visibility.Collapsed;
                        MessageBoxResult result = MessageBox.Show(AppResources.ConnectionError, "", MessageBoxButton.OK);
                    }
                }

                if (fromDormant)
                {
                    App.isFromDormant = false;
                    await loadMoreImage();
                }
            }
        }
예제 #2
0
 private void loadMoreImageButton_Click(object sender, RoutedEventArgs e)
 {
     if (imageParser != null && movie != null)
     {
         loadMoreImageButton.IsEnabled    = false;
         ImageProgressBar.Visibility      = System.Windows.Visibility.Visible;
         ImageProgressBar.IsIndeterminate = true;
         imageParser.loadMore();
     }
 }