日期:2014-05-17 浏览次数:21420 次
Geolocator geoloc = new Geolocator();
Geoposition position = await geoloc.GetGeopositionAsync();//h获得地理坐标
HttpClient httpClient = new HttpClient();
HttpResponseMessage httpResult = await httpClient.GetAsync(String.Format("http://maps.google.com/maps/api/geocode/xml?latlng={0},{1}&language=zh-CN&sensor=false", position.Coordinate.Latitude, position.Coordinate.Longitude));
var resss = await httpResult.Content.ReadAsStringAsync();
XmlDocument xml = new XmlDocument();
xml.LoadXml(resss);
var nr = xml.SelectNodes("GeocodeResponse").First();
var v = nr.SelectNodes("result").OrderBy(d => 1).Skip(3).Take(1).ToList().First();
var t = v.SelectNodes("formatted_address").First().InnerText;
GeoCoordinateWatcher watcher;
private void StartButton_Click(object sender, RoutedEventArgs e)
{
if (watcher == null)
{
//GeoPositionAccurac