protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (journeyElementsLazyAsync == null) { ErrorReporting.Log("journeyElementsLazyAsync is null"); if (NavigationService.CanGoBack) { NavigationService.GoBack(); } else { ErrorReporting.Log("Can not go back"); } return; } if (journeyElementsLazyBlock != null) { if (journeyElements.ItemsSource == null) { journeyElementsLazyBlock.Refresh(); } } else { title.Text = trainTitle; if (title.Text.Length > 40) { title.Text = title.Text.Replace(" to ", "\nto "); } journeyElementsLazyBlock = new LazyBlock <JourneyElement[]>( "live progress", "No information available", journeyElementsLazyAsync, items => items.Length == 0, new LazyBlockUI <JourneyElement>(this, journeyElements, journeyElementsMessageTextBlock, journeyElementsLastUpdatedTextBlock), Settings.GetBool(Setting.AutoRefresh), null, null, null); } }
private void LoadArrivals() { if (arrivalsLazyBlock == null) { arrivalsLazyBlock = new LazyBlock <Arrival[]>( "arrivals", "No more trains today", departuresAndArrivalsTable.GetArrivals(), items => items.Length == 0, new LazyBlockUI <Arrival>(this, arrivals, arrivalsMessageTextBlock, arrivalsLastUpdatedTextBlock), Settings.GetBool(Setting.AutoRefresh), null, null, null); } else if (arrivals.ItemsSource == null) { arrivalsLazyBlock.Refresh(); } }