DCSIMG
April 2012 - Posts - or ben shmueli

or ben shmueli

Press any key to continue, where's the any key? - Homer.S

April 2012 - Posts

Windows Phone GIS using Bing-Maps part 2

i changed a little bit the Gui from the old post, i add Textbox and a button and now it look like this:

a1

 

i add this 2 functions:

private void GoBtn_Click(object sender, RoutedEventArgs e)
     {
         ServiceReference1.SearchServiceClient _client = new SearchServiceClient();
      
         ServiceReference1.SearchRequest sr = new SearchRequest();
         sr.Credentials = new Credentials(){ApplicationId=_key};
         sr.Query = Searchtext.Text;
         _client.SearchAsync(sr);
         _client.SearchCompleted += new EventHandler<SearchCompletedEventArgs>(_client_SearchCompleted);
     }

     void _client_SearchCompleted(object sender, SearchCompletedEventArgs e)
     {

         // it returns a list of locations i just take the first one
         if(e.Result.ResultSets.ElementAt(0).Results.Count > 0)
         {

             GeoCoordinate gl = new GeoCoordinate();
             gl.Altitude = e.Result.ResultSets.ElementAt(0).Results[0].LocationData.Locations[0].Altitude;
             gl.Latitude = e.Result.ResultSets.ElementAt(0).Results[0].LocationData.Locations[0].Latitude;
             gl.Longitude = e.Result.ResultSets.ElementAt(0).Results[0].LocationData.Locations[0].Longitude;
           
             map1.SetView(gl,17);
          }
          }

 

and that`s it!

when you push seaview seattle it look like

a3