Beispiel #1
0
 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.");
     }
 }
Beispiel #2
0
        public void processGetRouteSummaryForStop(Object sender, UploadStringCompletedEventArgs e)
        {
            string reply = (string)e.Result;
            OCRouteSummaryForStop stop = OCSupport.makeRouteSummary(reply);

            Console.WriteLine(reply);
        }
Beispiel #3
0
        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;
            }
        }
Beispiel #4
0
        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();
        }