private RouteResponse TryRequestRouteResponse() { Osrm5x osrm = new Osrm5x(OsrmServerBaseUrl); RouteResponse response = null; try { RouteRequest request = new RouteRequest() { Coordinates = OsrmConverter.ConvertGeocoordinatesToLocations(Coordinates).ToArray(), Steps = true, Alternative = CalculateAlternativeRoutes }; response = osrm.Route(request); } catch (Exception e) { Console.WriteLine(e); if (response != null) { Console.WriteLine("Status Code of RouteRequest: " + response.Code); } } return(response); }
public void TryExecuteRequest() { RouteResponse response = TryRequestRouteResponse(); if (response != null && response.Code == AcceptingStatusCode) { RequestSuccessful = true; RequestedResponse = OsrmConverter.ConvertRouteResponseToRouteInfoResponse(response); } }