public void DoWork() { Initialize(); Console.WriteLine("Please, enter coordinates in form <latitude>, <longitude>. For ex.:37.4224764, -122.0842499."); Console.WriteLine("Enter <Q> when you done input."); Console.WriteLine("Origin coordinates:"); string[] origins = ReadConsoleStrings(); Console.WriteLine("Destination coordinates:"); string[] destinations = ReadConsoleStrings(); DistanceMatrixParameters distanceParameters = new DistanceMatrixParameters { Origins = new string[] { string.Join('|', origins) }, Destinactions = new string[] { string.Join('|', destinations) }, Units = "metric", Mode = "driving", Language = "en-US" }; DistanceMatrixResponse distanceResponse = distanceMatrixClient.GetDistance(distanceParameters); OutputDistanceResponse(distanceResponse); WriteToFile(_outputFileName, distanceResponse); Console.WriteLine("Please, press any key to exit"); Console.ReadKey(); }
public void Geocoding_GetDistance_statusOk() { DistanceMatrixParameters distanceParameters = new DistanceMatrixParameters { Origins = _originAdresses, Destinactions = _destinationAddresses, Units = _units, Mode = _mode, Language = _language }; DistanceMatrixResponse response = _distanceClient.GetDistance(distanceParameters); Assert.AreEqual(IsStatusOk(response.Status), true); }
private async Task <int> GetUpdatedMatrixEntryValue(Address origin, Address destinatoin) { var parameters = new DistanceMatrixParameters(); parameters.Origins.Add(origin.ToString()); parameters.Destinations.Add(destinatoin.ToString()); ServiceResponse <int> response; try { response = await _matrixApi.GetAddressInfoAsync(parameters, InfoType.Duration); if (response.Success) { return(response.Value); } } catch (Exception) { throw; } throw new Exception("Could not get service response"); }
public T GetDistance(DistanceMatrixParameters parameters) { return(_client.GetRequest <T>(parameters.GetParamsDictionary())); }