有人可以解释一下这些代码之间的区别吗?GeoCoordinate 属性在 GeocodeQuery 中的作用是什么?
#1 - 这仅适用于互联网连接
GeocodeQuery geocodeQuery = new GeocodeQuery();
geocodeQuery.GeoCoordinate = new GeoCoordinate();
geocodeQuery.SearchTerm = "London";
IList<MapLocation> locations = await geocodeQuery.GetMapLocationsAsync();
#2 - 这在没有互联网连接的情况下工作
// my location
Geolocator geolocator = new Geolocator();
geolocator.DesiredAccuracy = PositionAccuracy.High;
Geoposition position = await geolocator.GetGeopositionAsync();
// geocode query
GeocodeQuery geocodeQuery = new GeocodeQuery();
geocodeQuery.GeoCoordinate = position.Coordinate.ToGeoCoordinate();
geocodeQuery.SearchTerm = "London";
IList<MapLocation> locations = await geocodeQuery.GetMapLocationsAsync();