示例#1
0
    public static OCApiRoute newOCApiRoute(int routeNo, String routeID, int directionId, String direction, String routeHeading)
	{
        OCApiRoute route = new OCApiRoute();
        route.RouteNumber = routeNo;
        route.RouteID = routeID;
        route.DirectionID = directionId;
        route.Direction = direction;
        route.RouteHeading = routeHeading;
        return route;
	}
示例#2
0
    public static OCApiRoute newOCApiRoute(int routeNo, String routeID, int directionId, String direction, String routeHeading)
    {
        OCApiRoute route = new OCApiRoute();

        route.RouteNumber  = routeNo;
        route.RouteID      = routeID;
        route.DirectionID  = directionId;
        route.Direction    = direction;
        route.RouteHeading = routeHeading;
        return(route);
    }
示例#3
0
        private void routesList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var selectedItem = ((LongListSelector)sender).SelectedItem;

            if (selectedItem is OCApiRoute)
            {
                OCApiRoute route = (OCApiRoute)selectedItem;
                Navigation.NavigateToRoute(route.RouteNumber.ToString(), route.RouteHeading, int.Parse(stopID.Text), stopName.Text, route.RouteHeading);
            }

            ((LongListSelector)sender).SelectedItem = null;
        }
示例#4
0
    //Element Parsers

    private static List <OCApiRoute> makeRoute(XElement routes)
    {
        List <OCApiRoute> rts = new List <OCApiRoute>();
        int    routeNo, dirId;
        String dir, heading, routeID;

        foreach (XElement route in routes.Elements())
        {
            routeNo = int.Parse(route.Element("RouteNo").Value);
            routeID = "";
            dirId   = int.Parse(route.Element("DirectionID").Value);
            dir     = route.Element("Direction").Value;
            heading = route.Element("RouteHeading").Value;
            OCApiRoute routeObject = OCApiRoute.newOCApiRoute(routeNo, routeID, dirId, dir, heading);
            routeObject.BusName = heading.ToUpper();
            rts.Add(routeObject);
        }

        return(rts);
    }
示例#5
0
        private async void addFavourite_Click(object sender, RoutedEventArgs e)
        {
            var         menItem   = (MenuItem)sender;
            OCApiRoute  apiRoute  = (OCApiRoute)menItem.DataContext;
            OCDirection direction = OCDirection.newOCDirection(apiRoute.RouteNumber, apiRoute.RouteHeading, apiRoute.Direction, "", 0);

            direction.FromStopName    = stopName.Text;
            direction.FromStopNumber  = int.Parse(stopID.Text);
            direction.DirectionalName = "TO " + apiRoute.RouteHeading.ToUpper();
            int result = await OCTranspoStopsData.addFavouriteStop(direction);

            if (result > 0)
            {
                MessageBox.Show("Your favourite stop was succesfully added.");
            }
            else
            {
                MessageBox.Show("There was an error adding your favourite stop, please try again.");
            }
        }
示例#6
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;
            }
        }