public CardTransport(DirectionId direction, RouteType type, RouteId route) { _viewmodel = new TransportCardViewModel(direction, type, route); BindingContext = _viewmodel; InitializeComponent(); Update(); }
/// <summary> /// Requests the next departure for the specified route, direction, stop id and route type /// </summary> /// <param name="r">Route id</param> /// <param name="d">Direction id</param> /// <param name="s">Stop id</param> /// <param name="t">Route type</param> /// <returns>The next departure in a Departure object</returns> public static async Task <Departure> GetNextDeparture(RouteId r, DirectionId d, RouteType t) { StopId s = t == RouteType.Train ? StopId.GlenferrieTrain : d == DirectionId.MelbUniViaStKilda ? StopId.GlenferrieTramMelbUni : StopId.GlenferrieTramKew; Departure departure = (await PTV.RequestPTVPayloadAsync($"departures/route_type/{(int)t}/stop/{(int)s}/route/{(int)r}?direction_id={(int)d}&max_results=1")).Departures[0]; return(departure); }
/// <summary> /// Constructor to create a new Transport Card View Model /// </summary> /// <param name="direction">Direction id for the card</param> /// <param name="type"></param> public TransportCardViewModel(DirectionId direction, RouteType type, RouteId route) { Direction = direction; Type = type; Time = "--"; Route = route; }