标签:ons cti window read generic ati style threading system
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Devices.Geolocation;//引用此命名空间 namespace SimpleWeather { public class LocationManager { public async static Task< Geoposition >GetPosition() { var accessStatus = await Geolocator.RequestAccessAsync(); if (accessStatus != GeolocationAccessStatus.Allowed) throw new Exception(); var geolocator = new Geolocator { DesiredAccuracyInMeters = 0 }; var position = await geolocator.GetGeopositionAsync(); return position; } } }
实例化:
var position = await LocationManager.GetPosition();
通过position.Coordinate.Longitude,position.Coordinate.Latitude属性获得经纬度。
标签:ons cti window read generic ati style threading system
原文地址:http://www.cnblogs.com/rendan/p/7581469.html