private void searchProvider_SearchCompleted(object sender, BingSearchCompletedEventArgs e) { if (e.Cancelled) { return; } if (e.RequestResult.ResultCode != RequestResultCode.Success) { return; } StringBuilder sb = new StringBuilder(); SearchRequestResult requestResult = e.RequestResult; sb.Append(String.Format("Result Code: {0}\n", requestResult.ResultCode)); if (String.IsNullOrEmpty(requestResult.FaultReason)) { sb.Append(String.Format("Fault Reason: (none)\n", requestResult.FaultReason)); } else { sb.Append(String.Format("Fault Reason: {0}\n", requestResult.FaultReason)); } sb.Append(String.Format("Search Location: {0}\n", requestResult.Keyword)); sb.Append(String.Format("Estimated Matches: {0}\n", requestResult.EstimatedMatches)); sb.Append(String.Format("SearchResults:\n{0}", ProcessLocationList(requestResult.SearchResults))); tbSearchResult.Text = sb.ToString(); }
private void OnSearchCompleted(object sender, BingSearchCompletedEventArgs e) { if (e.Cancelled) { return; } if (e.RequestResult.ResultCode != RequestResultCode.Success) { teResult.Text = "The Bing Search service does not work for this location."; return; } StringBuilder resultList = new StringBuilder(""); int resCounter = 1; foreach (LocationInformation resultInfo in e.RequestResult.SearchResults) { resultList.Append(String.Format("Result {0}: \r\n", resCounter)); resultList.Append(String.Format("Name: {0}\r\n", resultInfo.DisplayName)); resultList.Append(String.Format("Address: {0}\r\n", resultInfo.Address.FormattedAddress)); resultList.Append(String.Format("Geographic coordinates: {0}\r\n", resultInfo.Location)); resultList.Append(String.Format("______________________________\r\n")); resCounter++; } teResult.Text = resultList.ToString(); }
void searchProvider_SearchCompleted(object sender, BingSearchCompletedEventArgs e) { SearchRequestResult result = e.RequestResult; if (result.ResultCode == RequestResultCode.Success) { LocationInformation region = result.SearchRegion; if (region != null) { NavigateTo(region.Location); } else { if (result.SearchResults.Count > 0) { NavigateTo(result.SearchResults[0].Location); } } //DisplayResults(e.RequestResult); } if (result.ResultCode == RequestResultCode.BadRequest) { XtraMessageBox.Show("The Bing Search service does not work for this location."); } }
private void searchDataProvider_SearchCompleted(object sender, BingSearchCompletedEventArgs e) { SearchRequestResult result = e.RequestResult; if (result.ResultCode == RequestResultCode.Success) { List <LocationInformation> regions = result.SearchResults; foreach (LocationInformation region in regions) { AddPushpin(region.Location); if (idx == addresses.Count) { map.ZoomToFitLayerItems(); } } DisplayResults(e.RequestResult); asyncResult = this.BeginInvoke((DoSearch)SearchAsync); } if (result.ResultCode == RequestResultCode.BadRequest) { tbResults.Text += "The Bing Search service does not work for this location."; } }
void SearchProvider_SearchCompleted(object sender, BingSearchCompletedEventArgs e) { if (e.Cancelled || (e.RequestResult.ResultCode != RequestResultCode.Success)) { return; } if (e.RequestResult.SearchResults.Count != 0) { GenerateItems(e.RequestResult.SearchResults); } }
void OnDataProviderSearchCompleted(object sender, BingSearchCompletedEventArgs e) { IsVisible = !e.Cancelled && e.RequestResult.ResultCode == RequestResultCode.Success; if (IsVisible) { Location = e.RequestResult.SearchRegion.Location; try { LocationCache.Add(e.RequestResult.Location, Location); } catch { } } }
private void SearchCompleted(object sender, BingSearchCompletedEventArgs e) { if (e.Cancelled || (e.RequestResult.ResultCode != RequestResultCode.Success)) { return; } if (e.RequestResult.SearchResults.Count != 0) { GenerateItems(e.RequestResult.SearchResults); } else { GenerateItems(new LocationInformation[] { e.RequestResult.SearchRegion }); } }
private void searchDataProvider_SearchCompleted(object sender, BingSearchCompletedEventArgs e) { SearchRequestResult result = e.RequestResult; if (result.ResultCode == RequestResultCode.Success) { if (result.SearchResults.Count > 0) { NavigateTo(result.SearchResults[0].Location); } DisplayResults(e.RequestResult); } if (result.ResultCode == RequestResultCode.BadRequest) { tbResults.Text = "The Bing Search service does not work for this location."; } }
private void SearchDataProvider_SearchCompleted(object sender, BingSearchCompletedEventArgs e) { SearchRequestResult result = e.RequestResult; if (result.ResultCode == RequestResultCode.Success) { //List<LocationInformation> regions = result.SearchResults; //Really we should display all the returned regions for disambiguation, but we're just going with the best match //which is the first one LocationInformation region = result.SearchResults.FirstOrDefault(); AddOrMovePushpin(region.Location); MapControl.ZoomLevel = 13; SaveMapData(); } if (result.ResultCode == RequestResultCode.BadRequest) { this.DisplayWarning("The Bing Search service does not work for this location."); } }
private void BingSearchDataProvider_SearchCompleted(object sender, BingSearchCompletedEventArgs e) { if (e.Cancelled) { return; } if (e.RequestResult.ResultCode != RequestResultCode.Success) { return; } storage.Items.Clear(); if (e.RequestResult.SearchResults.Count != 0) { foreach (LocationInformation locationInformation in e.RequestResult.SearchResults) { AddMapItem(locationInformation); } } else { AddMapItem(e.RequestResult.SearchRegion); } }
private void bingSearchDataProvider_SearchCompleted(object sender, BingSearchCompletedEventArgs e) { GeoPoint topLeft = e.RequestResult.SearchResults[0].Location; mapControl1.ZoomToRegion(topLeft, topLeft, 0.4); }