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; }
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); }
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; }
//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); }
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."); } }
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; } }