SearchProvider with AutoResetEvent

2 posts, 0 answers
  1. Manuel
    Manuel avatar
    43 posts
    Member since:
    Jul 2010

    Posted 15 Apr 2015 Link to this post

    Dear All,

    together with the address the Longitude & Latitude should be saved.

    I tried to use the AutoResetEvent but it is not working.

    After WaitOne() is called, nothing happens. The EventHanlder is never called.

    Please let me know if you have an idea.


    AutoResetEvent waitHandle = new AutoResetEvent(false); 

    if (fullAddress != String.Empty && Item.Longitude == 0 && Item.Latitude == 0)
        Telerik.Windows.Controls.Map.BingSearchProvider provider = new Telerik.Windows.Controls.Map.BingSearchProvider(bingApplicationId);
        Telerik.Windows.Controls.Map.SearchRequest newSearchRequest = new Telerik.Windows.Controls.Map.SearchRequest();
        newSearchRequest.Query = fullAddress;

        EventHandler<Telerik.Windows.Controls.Map.SearchCompletedEventArgs> eventHandler = delegate(object sender, Telerik.Windows.Controls.Map.SearchCompletedEventArgs e) 
                foreach (Telerik.Windows.Controls.Map.SearchResultSet result in e.Response.ResultSets)
                    if (result.SearchRegion != null)
                        Item.Longitude = Convert.ToDecimal(result.SearchRegion.GeocodeLocation.BestView.Center.Longitude);
                        Item.Latitude = Convert.ToDecimal(result.SearchRegion.GeocodeLocation.BestView.Center.Latitude);
                        Debug.WriteLine(String.Format("{0} Latitude:{1} Longitude:{2}", Item.Name1, Item.Latitude, Item.Longitude));


        provider.SearchCompleted += eventHandler;



  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1236 posts

    Posted 17 Apr 2015 Link to this post

    Hello Manuel,

    Unfortunately, the provided information is not enough to understand your current setup, requirement and the issues that you encounter.

    Please elaborate more on your scenario. What you need to achieve? When are you trying to do it? What prevents you from implementing your requirement?

    Please keep in mind that providing as detailed information as possible will help us to better handle your case.

    Pavel R. Pavlov

    See What's Next in App Development. Register for TelerikNEXT.

Back to Top