示例#1
0
        /// <summary> Performs a multi field geocoding request. </summary>
        /// <param name="data"> The data for the multi field geocoding. </param>
        public void LocateMultiField(MultiFieldData data)
        {
            if (mfg == null)
            {
                return;
            }

            Mouse.OverrideCursor = Cursors.Wait;
            mfg.LocateMultiField(data);
        }
示例#2
0
        /// <summary> Triggers the geocoding of the given multi field data. The call is asynchronously i.e. the caller
        /// is not blocked. The result is stored in the <see cref="GeocoderBase.Addresses"/> property. </summary>
        /// <param name="data"> The data to geocode. </param>
        public void LocateMultiField(MultiFieldData data)
        {
            Addresses.Clear();

            if (data.IsEmpty())
            {
                return;
            }

            #region doc:call xlocate
            XLocateWS xLocate = XServerClientFactory.CreateXLocateClient(Properties.Settings.Default.XUrl);

            var address = new Address
            {
                country  = data.Country,
                state    = data.State,
                postCode = data.PostalCode,
                city     = data.City,
                street   = data.Street
            };
            try
            {
                xLocate.BeginfindAddress(new findAddressRequest
                {
                    Address_1       = address,
                    CallerContext_5 = new CallerContext
                    {
                        wrappedProperties = new[] { new CallerContextProperty {
                                                        key = "CoordFormat", value = "PTV_MERCATOR"
                                                    } }
                    },
                }, LocateMultiFieldComplete, xLocate);
            }
            catch (EntryPointNotFoundException)
            {
                errorDelegate.Invoke(Properties.Resources.ErrorGeocodeEndpointNotFound);
            }
            catch (Exception ex)
            {
                errorDelegate.Invoke(ex.Message);
            }
            #endregion
        }