public void processGetNextTripForStop(Object sender, UploadStringCompletedEventArgs e) { try { loadingProgressBar.IsVisible = true; loadingProgressBar.Text = "Loading favourites data ..."; string reply = (string)e.Result; OCNextTripForStop stop = OCSupport.makeNextTrip(reply); if (stop != null) { favourites.Clear(); foreach (OCDirection direction in stop.Directions) { direction.FromStopName = stop.StopLabel; direction.FromStopNumber = stop.StopNo; direction.DirectionalName = "to " + direction.RouteLabel.ToUpper(); favourites.Add(direction); } this.favouritesList.ItemsSource = favourites; setFavouriteErrorMessage(false, favourites.Count > 0); loadingProgressBar.IsVisible = false; } else { loadingProgressBar.IsVisible = false; setFavouriteErrorMessage(true, false); } } catch { loadingProgressBar.IsVisible = false; setFavouriteErrorMessage(true, false); MessageBox.Show("There was an issue getting your data! Please check your data connection and try again."); } }
public void processGetRouteSummaryForStop(Object sender, UploadStringCompletedEventArgs e) { string reply = (string)e.Result; OCRouteSummaryForStop stop = OCSupport.makeRouteSummary(reply); Console.WriteLine(reply); }
public async void processRouteSummaryForStop(Object sender, UploadStringCompletedEventArgs e) { string reply = (string)e.Result; OCRouteSummaryForStop stop = OCSupport.makeRouteSummary(reply); if (stop != null) { List <OCApiRoute> routesListObject = stop.Routes; foreach (OCApiRoute route in routesListObject) { OCApiRoute route1 = await route.fetchTimes(stop.StopNumber.ToString()); route.fourArrivalTimes = route1.fourArrivalTimes; route.nextTimes = route1.nextTimes; } routes = new ObservableCollection <OCApiRoute>(routesListObject); setIsLoading(false); routesList.ItemsSource = routes; } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); string msg = ""; if (NavigationContext.QueryString.TryGetValue("stopRoute", out msg)) { if (msg.Length == 0) { msg = "0"; } stopID.Text = msg; OCSupport.getRouteSummaryForStop(int.Parse(msg), new UploadStringCompletedEventHandler(processRouteSummaryForStop)); } if (NavigationContext.QueryString.TryGetValue("stopName", out msg)) { stopName.Text = msg; } setIsLoading(true); routesListInit(); }