internal MultiReverseGeocodeRequest(MapService service, IEnumerable <Geocoordinates> coordinates) : base(service, ServiceRequestType.ReverseGeocode) { // The Maps Service invokes this callback once when gets the response from map service provider // The value of total is same with requested coordinates list size. Even though one of address is not provided valid address handle is retrieved. _geocodeCallback = (result, id, total, handle, userData) => { errorCode = result; if (result.IsSuccess()) { var addressListHandle = new Interop.AddressListHandle(handle, needToRelease: true); var addressList = new PlaceAddressList(addressListHandle); _addressesList = addressList.Addresses as List <PlaceAddress>; _requestTask?.TrySetResult(_addressesList); return(true); } else { _requestTask?.TrySetException(errorCode.GetException(errMessage)); return(false); } }; var coordinateList = new GeocoordinatesList(coordinates); startExecutionAction = new Action(() => { int requestID; errMessage = "Failed to get address list for given co-ordinate list"; errorCode = _service.handle.MultiReverseGeocode(coordinateList.handle, _service.Preferences.handle, _geocodeCallback, IntPtr.Zero, out requestID); if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled) { _requestTask?.TrySetException(errorCode.GetException(errMessage)); } _requestID = requestID; }); }
internal PlaceAddressList(Interop.AddressListHandle nativeHandle) { handle = nativeHandle; }
/// <summary> /// Constructs a map address list object. /// </summary> /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception> /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory.</exception> public PlaceAddressList() { handle = new Interop.AddressListHandle(); }