private RouteSearchRequest(MapService service, ServiceRequestType type) : base(service, type) { // The Maps Service invokes this callback while iterating through the set of obtained Routes. _routeCallback = (result, id, index, total, route, userData) => { errorCode = result; if (result.IsSuccess()) { // The parameter route must be released using maps_route_destroy(). var routeHandle = new Interop.RouteHandle(route, needToRelease: true); _routeList.Add(new Route(routeHandle)); if (_routeList.Count == total) { _requestTask?.TrySetResult(_routeList); } return(true); } else { // If search is failed, the value of total is 0 and route is NULL. _requestTask?.TrySetException(errorCode.GetException(errMessage)); return(false); } }; }
internal Route(Interop.RouteHandle nativeHandle) { handle = nativeHandle; }