private void OnLocationInformationReceived(object sender, LocationInformationReceivedEventArgs e) { if (e.Cancelled == true) { return; } if (e.Result.ResultCode != RequestResultCode.Success) { meResult.Text = "The Bing Geocode service does not work for this location."; return; } StringBuilder resultList = new StringBuilder(""); int resCounter = 1; foreach (LocationInformation locations in e.Result.Locations) { resultList.Append(String.Format("Request Result {0}:\r\n", resCounter)); resultList.Append(String.Format(locations.EntityType + "\r\n")); resultList.Append(String.Format(locations.Address.FormattedAddress + "\r\n")); resultList.Append(String.Format("Coordinates: {0}\r\n", locations.Location)); resultList.Append(String.Format("______________________________\r\n")); resCounter++; } meResult.Text = resultList.ToString(); }
private void OnLocationInformationReceived(object sender, LocationInformationReceivedEventArgs e) { if ((e.Cancelled) && (e.Result.ResultCode != RequestResultCode.Success)) { return; } informationLayer1.Data.Items.Clear(); foreach (LocationInformation locationInformation in e.Result.Locations) { string[] country = locationInformation.DisplayName.Split(','); getCountryName = country[country.Count() - 2] + ", " + country[country.Count() - 1]; getLongitude = locationInformation.Location.Longitude; getLatitude = locationInformation.Location.Latitude; informationLayer1.Data.Items.Add(new MapCallout() { Location = locationInformation.Location, Text = locationInformation.DisplayName }); } buttonOK.Enabled = true; textBoxCountryName.Text = getCountryName; }
private void geocodeProvider_LocationInformationReceived(object sender, LocationInformationReceivedEventArgs e) { GeocodeRequestResult result = e.Result; StringBuilder resultList = new StringBuilder(""); resultList.Append(String.Format("Status: {0}\n", result.ResultCode)); resultList.Append(String.Format("Fault reason: {0}\n", result.FaultReason)); resultList.Append(String.Format("______________________________\n")); if (result.ResultCode != RequestResultCode.Success) { tbResults.Text = resultList.ToString(); return; } int resCounter = 1; foreach (LocationInformation locations in result.Locations) { resultList.Append(String.Format("Request Result {0}:\n", resCounter)); resultList.Append(String.Format("Display Name: {0}\n", locations.DisplayName)); resultList.Append(String.Format("Entity Type: {0}\n", locations.EntityType)); resultList.Append(String.Format("Address: {0}\n", locations.Address)); resultList.Append(String.Format("Location: {0}\n", locations.Location)); resultList.Append(String.Format("______________________________\n")); resCounter++; } tbResults.Text = resultList.ToString(); }
private void LocationInformationReceived(object sender, LocationInformationReceivedEventArgs e) { if ((e.Cancelled) && (e.Result.ResultCode != RequestResultCode.Success)) { return; } GenerateItems(e.Result.Locations); }
void GeocodeProvider_LocationInformationReceived(object sender, LocationInformationReceivedEventArgs e) { if (e.Cancelled) { return; } GenerateItems(e.Result.Locations); }
void GeocodeProvider_LocationInformationReceived(object sender, LocationInformationReceivedEventArgs e) { if ((e.Cancelled) && (e.Result.ResultCode != RequestResultCode.Success)) { return; } GeocodeLayer.Data.Items.Clear(); foreach (LocationInformation locationInformation in e.Result.Locations) { GeocodeLayer.Data.Items.Add(new MapCallout() { Location = locationInformation.Location, Text = locationInformation.DisplayName }); } }
void GeoCode_LocationInformationReceived(object sender, LocationInformationReceivedEventArgs e) { if (e.UserState == null || !string.IsNullOrEmpty(e.Result.FaultReason) || e.Result.ResultCode != RequestResultCode.Success) { SplashScreenManager.CloseForm(false); return; } List <DmFile> files = (List <DmFile>)e.UserState; BingAddress adress = e.Result.Locations.Length > 0 ? (BingAddress)e.Result.Locations[0].Address : null; SplashScreenManager.Default.SendCommand(DmWaitFormCommand.SetCaption, "Map"); SplashScreenManager.Default.SendCommand(DmWaitFormCommand.SetDescription, "Updating Data..."); SplashScreenManager.Default.SendCommand(DmWaitFormCommand.SetUndefined, true); Model.BeginUpdate(); foreach (DmFile file in files) { Model.BeginUpdateFile(file); file.Latitude = (float)HitPoint.Latitude; file.Longitude = (float)HitPoint.Longitude; if (adress != null) { file.Country = adress.CountryRegion; file.State = adress.AdminDistrict; file.Location = adress.AddressLine; file.City = adress.PostalTown; } Model.EndUpdateFile(file); } Model.EndUpdate(); UpdateLayers(); RefreshDataSource(); SplashScreenManager.CloseForm(); }