Windows phone 8.1 为windows phone 8.1的位置状态更改事件创建委托方法
我目前正在使用windows phone 8.1[RT]应用程序,我正在使用地图服务的地理位置,我希望在设备位置打开/关闭时发生事件,与internet连接的Windows phone 8.1 为windows phone 8.1的位置状态更改事件创建委托方法,windows-phone-8.1,location,Windows Phone 8.1,Location,我目前正在使用windows phone 8.1[RT]应用程序,我正在使用地图服务的地理位置,我希望在设备位置打开/关闭时发生事件,与internet连接的NetworkStatusChangedEventHandler相同。 我已经为此创建了以下代码 public static bool IsLocationOn { get { Geolocator locator = new Geolocator();
NetworkStatusChangedEventHandler
相同。
我已经为此创建了以下代码
public static bool IsLocationOn
{
get
{
Geolocator locator = new Geolocator();
if (locator.LocationStatus == PositionStatus.Disabled)
{
return false;
}
else
{
return true;
}
}
}
但我希望在整个应用程序上触发事件
谢谢地理定位器有一个活动。从那以后,这只是订阅的问题
locator.StatusChanged += Geolocator_StatusChanged;
private void Geolocator_StatusChanged(Geolocator locator, StatusChangedEventArgs e)
{
// Whatever
}