In the Search Location article, I've successfully tried out both Examples 2 and 3. Each of them use SearchLocationAsync to make the request and restProvider_SearchLocationCompleted to handle the return. In my app, I'd like to provide the user with the ability to search by address or location, and to do other things, too, but it looks like there can be only one implementation of restProvider_SearchLocationCompleted. Of course, each request will need its own handling of the return, so how is that best accomplished?
I noticed that BingRestSearchLocationCompletedEventArgs has a UserData property that's an Object, so I assume the caller can create an object of their own design, populate it as desired and have it returned through this property. If so, I could include an enum which my handler could use to determine how to process the return, which would solve my need.
The problem I'm having, though, is that I don't know how to send that UserData object along with my request. There doesn't seem to be a parameter in the BingRestSearchLocation method that would allow me to.
So, I have two questions:
1. Is what I'm suggesting the normal way of handling this? If not, what is normally done?
2. How does one send UserData in the request, so that it comes through in the completion handler?