Click or drag to resize

DrillDownGeoCoderBeginGetStreets Method

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Begins an asynchronous street search operation.

Namespace:  Telogis.GeoBase
Assembly:  geobase.net (in geobase.net.dll) Version: 4.97.0.0
Syntax
public IAsyncResult BeginGetStreets(
	string searchstring,
	AsyncCallback asyncCallback,
	Object asyncstate
)

Parameters

searchstring
Type: SystemString
The search term used to find streets.
asyncCallback
Type: SystemAsyncCallback
Method to call when the search is complete.
asyncstate
Type: SystemObject
The state of the asynchronous search.

Return Value

Type: IAsyncResult
IAsyncResult allowing the caller to query the state of the search.
Remarks

An asynchronous street search is performed using the drilldown geocoder's BeginGetStreets in conjunction with AbortGetStreets, and EndGetStreets. AbortGetStreets simply cancels an asynchronous street search operation; in the example below, it is used to cancel any previous search operation, so that we can safely start a new search.

BeginGetStreets will create a new thread and begin the search operation. When the search is complete, the callback function that is passed to BeginGetStreets is called. In the example below, the callback function (GetStreetsCallback(IAsyncResult searchResult)) calls UpdateStreetsList(), which in turn calls EndGetStreets to return the search results, once the search has completed, and populates the list box 'listBoxResults'.

Examples

This example assumes that the region levels, in the drill-down geocoder, have been set. It also assumes that we have a drilldown geocoder, called 'ddgc', and a list box to place the street search results in to, called 'listBoxResults'.

C#
IAsyncResult asyncSearch;

private void searchSteets(string filterText){
 //Ensure previous asynchronous street search operation has stopped 
 ddgc.AbortGetStreets(asyncSearch);

 //Begin the asynchronous search
 asyncSearch = ddgc.BeginGetStreets(filterText, getStreetsCallback, null);
}

private void getStreetsCallback(IAsyncResult searchResult) {
 updateStreetsList();
}

private void updateStreetsList() {
 if (InvokeRequired) {
  Invoke(new MethodInvoker(UpdateStreetsList));
 } else {
    StreetData[] sdlist = ddgc.EndGetStreets(asyncSearch).Results;
    listBoxResults.Items.AddRange(sdlist);
 }
}
See Also