public void StopsForRoute(GeoCoordinate location, Route route, StopsForRoute_Callback callback) { string requestUrl = string.Format( "{0}/{1}/{2}.xml?key={3}&Version={4}", WebServiceUrlForLocation(location), "stops-for-route", route.id, KEY, APIVERSION ); directionCache.DownloadStringAsync(new Uri(requestUrl), new GetDirectionsForRouteCompleted(requestUrl, route.id, directionCache, callback).HttpCache_Completed); }
public void StopsForLocation(GeoCoordinate location, string query, int radiusInMeters, int maxCount, bool invalidateCache, StopsForLocation_Callback callback) { GeoCoordinate roundedLocation = GetRoundedLocation(location); // ditto for the search radius -- nearest 50 meters for caching int roundedRadius = (int)(Math.Round(radiusInMeters / 50.0) * 50); string requestString = string.Format( "{0}/{1}.xml?key={2}&lat={3}&lon={4}&radius={5}&Version={6}", WebServiceUrlForLocation(location), "stops-for-location", KEY, roundedLocation.Latitude.ToString(NumberFormatInfo.InvariantInfo), roundedLocation.Longitude.ToString(NumberFormatInfo.InvariantInfo), roundedRadius, APIVERSION ); if (string.IsNullOrEmpty(query) == false) { requestString += string.Format("&query={0}", query); } if (maxCount > 0) { requestString += string.Format("&maxCount={0}", maxCount); } Uri requestUri = new Uri(requestString); if (invalidateCache) { stopsCache.Invalidate(requestUri); } stopsCache.DownloadStringAsync(requestUri, new GetStopsForLocationCompleted(requestString, stopsCache, callback).HttpCache_Completed); }