Niyo

getLocationCoordsfromAdress

Jan 19th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1.     /// <summary>
  2.         /// Get Coordinates from adress
  3.         /// </summary>
  4.         /// <param name="searchTerm"></param>
  5.         private async void getLocationCoordsfromAdress(string searchTerm)
  6.         {
  7.             GeocodeQuery a = new GeocodeQuery();
  8.  
  9.             Geoposition geoposition = await getLocation();
  10.  
  11.             if (geoposition != null)
  12.                 a.GeoCoordinate = new GeoCoordinate(geoposition.Coordinate.Latitude, geoposition.Coordinate.Longitude);
  13.             else
  14.                 a.GeoCoordinate = new GeoCoordinate();
  15.             a.SearchTerm = searchTerm; // mock search, replace with search value
  16.  
  17.             a.QueryCompleted += (s, e) =>
  18.             {
  19.                 if (e.Error == null && e.Result.Count > 0)
  20.                 {
  21.                     // DO SOMETHING SERIOUS
  22.                 }
  23.             };
  24.  
  25.             a.QueryAsync();
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment