如果需要准确定位的位置,设备每移动100米就进行数据更新,可以这样写:

GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Hight);
watcher.MovementThreshold =100;
watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);
watcher.Start();

private void watcher_PositionChanged(object sender , GeoPositionChangedEventArgs<GeoCoordinate> e)
{
Deployment.Current.Dispatcher.BiginInvoke( ()=>MyPositionChanged(e));
}

private void MyPositionChanged(GeoPositionChangedEventArgs<GeoCoordinate> e)
{
LongitudeTextBlock.Text = e.Position.Location.Longitude.ToString("0");
LatitudeTextBlock.Text = e.Position.Location.Latitude.ToString("0");
}

相关文章:

  • 2022-02-10
  • 2021-11-02
  • 2021-07-29
  • 2021-07-09
  • 2022-01-29
  • 2022-02-26
  • 2021-10-28
  • 2021-09-21
猜你喜欢
  • 2022-01-27
  • 2022-03-07
  • 2021-12-22
  • 2021-09-23
  • 2021-10-26
  • 2021-11-04
  • 2021-09-17
相关资源
相似解决方案