private void PopulateRoute(String routeID, String subRouteUID) { IEnumerable <StopOfRoute> stopsOfSingleRoute = StopOfRoute.RetrieveFromJson(string.Format(URL_STOP_OF_ROUTE, routeID)) .Where(entity => string.Equals(entity.SubRouteUID, subRouteUID)); if (stopsOfSingleRoute.Count() == 0) { return; } IEnumerable <RoutePrediction> predictions = RoutePrediction.RetrieveFromJson(string.Format(URL_ESTIMATED_ARRIVAL, routeID, subRouteUID)); StopArrivalPrediction view = new StopArrivalPrediction(stopsOfSingleRoute.First(), predictions); Content = new ScrollView { Content = view }; }
public StopArrivalPrediction(StopOfRoute stopsOfSingleRoute, IEnumerable <RoutePrediction> predictions) : base() { Spacing = 3; Padding = new Thickness(20, 20, 20, 0); List <string> displayedPlateNumbers = new List <string>(); foreach (StopOfRoute.Stop stop in stopsOfSingleRoute.Stops) { string stopName = stop.StopName.Zh_tw; IEnumerable <RoutePrediction> candidatePredictions = predictions.Where(prediction => string.Equals(stopName, prediction.StopName.Zh_tw)); if (candidatePredictions.Count() != 1) { continue; } RoutePrediction currentPrediction = candidatePredictions.First(); PopulatePredictionViewByStop(stopName, currentPrediction, displayedPlateNumbers); } }