protected override async void OnNavigatedTo(NavigationEventArgs e) { MapControlLocation.MapServiceToken = App.bingMapsApiKey; if (e.Parameter is BusData) { data = e.Parameter as BusData; TextBlockTitle.Text = "Bus Locations for Route " + data.routeNumber + " " + data.routeDirection; try { await LoadBusPositions(); DisplayBusPositions(); } catch (COMException ex) { DisplayErrorMessage("Couldn't connect to the server. Please check your internet connection!"); } catch (Exception ex) { DisplayErrorMessage("An error occurred when getting bus locations. Please go back and try again."); } } else { DisplayErrorMessage("An error occurred when getting bus locations. Please go back and try again."); } base.OnNavigatedTo(e); }
private void ListViewStopEstimates_SelectionChanged(object sender, SelectionChangedEventArgs e) { BusData data = new BusData(); data.stopNumber = stopNumber; data.routeNumber = stopEstimates[ListViewStopEstimates.SelectedIndex].RouteNo; data.routeDirection = stopEstimates[ListViewStopEstimates.SelectedIndex].Direction; Frame.Navigate(typeof(BusLocationsPage), data); }