Пример #1
0
        protected async Task <T> SendAsync <T>(string service, BaseRequest request) //string coordinatesStr, List<Tuple<string, string>> urlParams)
        {
            var coordinatesStr = request.CoordinatesUrlPart;
            List <Tuple <string, string> > urlParams = request.UrlParams;
            var fullUrl = OsrmRequestBuilder.GetUrl(Url, service, Version, Profile, coordinatesStr, urlParams);

            var responseString = await client.GetStringAsync(fullUrl);

            return(JsonConvert.DeserializeObject <T>(responseString));;
        }
Пример #2
0
        protected T Send <T>(string service, BaseRequest request) //string coordinatesStr, List<Tuple<string, string>> urlParams)
        {
            var coordinatesStr = request.CoordinatesUrlPart;
            List <Tuple <string, string> > urlParams = request.UrlParams;
            var    fullUrl = OsrmRequestBuilder.GetUrl(Url, service, Version, Profile, coordinatesStr, urlParams);
            string json    = null;

            using (var client = new OsrmWebClient(Timeout))
            {
                json = client.DownloadString(new Uri(fullUrl));
            }

            return(JsonConvert.DeserializeObject <T>(json));;
        }