private void loadUSBoxPivotItem() { // Get us box USBoxProgressBar.IsIndeterminate = true; USBoxProgressBar.Visibility = System.Windows.Visibility.Visible; USBoxJsonParser.usboxLongListSelector = usboxLongListSelector; USBoxJsonParser.progressBar = USBoxProgressBar; USBoxJsonParser.loaded = usboxLoaded; USBoxJsonParser.parseUSBox(); }
private async Task loadUSBoxPivotItem() { // Get us box bool fromDormant = false; USBoxProgressBar.IsIndeterminate = true; USBoxProgressBar.Visibility = System.Windows.Visibility.Visible; try { usboxLongListSelector.ItemsSource = await USBoxJsonParser.getUSMovie(); USBoxProgressBar.Visibility = System.Windows.Visibility.Collapsed; } catch (TaskCanceledException) { if (App.isFromDormant) { fromDormant = true; } else { USBoxProgressBar.Visibility = System.Windows.Visibility.Collapsed; usboxLoaded = false; MessageBoxResult result = MessageBox.Show(AppResources.ConnectionError, "", MessageBoxButton.OK); } } catch (Exception) { if (App.isFromDormant) { fromDormant = true; } else { USBoxProgressBar.Visibility = System.Windows.Visibility.Collapsed; usboxLoaded = false; MessageBoxResult result = MessageBox.Show(AppResources.ConnectionError, "", MessageBoxButton.OK); } } if (fromDormant) { App.isFromDormant = false; await loadUSBoxPivotItem(); } }