sabato 18 agosto 2007

LocationFinder: a web control findig places

Today a simple web custom control based on the Microsoft Virtual Earth APIs and that can search for places and/or business simply passing what and/or where, similarly to Live Local Search.

The control hasn't any property, but only a method and an event:

void Find(string what, string where, int start, int length)

Method that performs a what (business) search and/or a where (location) search (at least one of these two parameters is required)., for the answer you must wait for the event.

what: the business name, category, or other item searched for(es. "pizza")
where: the address or place name of the area searched for (es. "New York")
start: the beginning index of the results returned
length: the number of results to be returned (max. 20)

void LocationFinder_Found(object sender, VEFindResult[] results, VEPlace[] places, bool hasmore)

Event that returns a list of results and a list of places.

results: array of VEFindResult (list of results)
places: array of VEPlace (list of ambiguous places)
hasmore: true if there are others results (at the moment doesn't work!)

There are also two structures:





(the function of each member is intuitive)

You can download the control by clicking here or test it here.
The zip contains the DLL (put it in the bin directory and add the control to the toolbox of Visual Studio) and the source (FadingImage.cs).
How to use the DLL in your WEB projects:
1 - put the DLL fille in the Bin directory of the site;
2 - if you want to add the control to Visual Studio toolbox, right-click on it, click on "Choose Items ..." and browse the project to add the DLL.
Note: if you want to modify the source remeber to add the right references (System.Web, System.Web.Extension, System.Drawing)
That's all.

Nessun commento: