Exemple #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.");
     }
 }
    public static OCNextTripForStop newOCNextTripForStop(int stopNo, String stopLabel, List <OCDirection> directions)
    {
        OCNextTripForStop direction = new OCNextTripForStop();

        direction.StopNo     = stopNo;
        direction.StopLabel  = stopLabel;
        direction.Directions = directions;
        return(direction);
    }
Exemple #3
0
    public static OCNextTripForStop makeNextTrip(String xml)
    {
        try
        {
            XElement root = XDocument.Parse(removeSOAPWrapper(xml)).Root;
            int      stopNo;
            String   stopLabel;
            XElement dir;

            stopNo    = int.Parse(root.Element("StopNo").Value);
            stopLabel = root.Element("StopLabel").Value;
            dir       = root.Element("Route");

            return(OCNextTripForStop.newOCNextTripForStop(stopNo, stopLabel, makeDirection(dir)));
        }
        catch
        {
            MessageBox.Show("There was an issue getting your data, please try again.");
            return(null);
        }
    }