Exemplo n.º 1
0
        /// <summary>
        /// This method will reverse geocode the ground station based on its location and
        /// call the callback method.
        /// </summary>
        /// <param name="name">Name of the ground station</param>
        /// <param name="id">id of the station</param>
        /// <param name="location">Location of the ground station</param>
        private void reverseGeocode(string name, string id, Location location)
        {
            ReverseGeocodeRequest reverseGeocodeRequest = new ReverseGeocodeRequest();

            // Set the credentials using a valid Bing Maps key
            reverseGeocodeRequest.Credentials = new Credentials();
            reverseGeocodeRequest.Credentials.ApplicationId = this.BingMapsKey;

            // Set the point to use to find a matching address
            GeocodeService.GeocodeLocation point = new GeocodeService.GeocodeLocation();
            point.Latitude  = location.Latitude;
            point.Longitude = location.Longitude;
            reverseGeocodeRequest.Location = point;

            // Make the reverse geocode request
            GeocodeServiceClient geocodeService = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService");

            geocodeService.ReverseGeocodeCompleted += new EventHandler <ReverseGeocodeCompletedEventArgs>(
                delegate(object sender, ReverseGeocodeCompletedEventArgs e)
            {
                this.reverseGeocodeCompleted(sender, e, name, id, location);
            });
            geocodeService.ReverseGeocodeAsync(reverseGeocodeRequest);
        }
        /// <summary>
        /// This method will reverse geocode the ground station based on its location and
        /// call the callback method.
        /// </summary>
        /// <param name="name">Name of the ground station</param>
        /// <param name="id">id of the station</param>
        /// <param name="location">Location of the ground station</param>
        private void reverseGeocode(string name, string id, Location location)
        {
            ReverseGeocodeRequest reverseGeocodeRequest = new ReverseGeocodeRequest();

            // Set the credentials using a valid Bing Maps key
            reverseGeocodeRequest.Credentials = new Credentials();
            reverseGeocodeRequest.Credentials.ApplicationId = this.BingMapsKey;

            // Set the point to use to find a matching address
            GeocodeService.GeocodeLocation point = new GeocodeService.GeocodeLocation();
            point.Latitude = location.Latitude;
            point.Longitude = location.Longitude;
            reverseGeocodeRequest.Location = point;

            // Make the reverse geocode request
            GeocodeServiceClient geocodeService = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
            geocodeService.ReverseGeocodeCompleted += new EventHandler<ReverseGeocodeCompletedEventArgs>(
                delegate(object sender, ReverseGeocodeCompletedEventArgs e)
                {
                    this.reverseGeocodeCompleted(sender, e, name, id, location);
                });
            geocodeService.ReverseGeocodeAsync(reverseGeocodeRequest);
        }