public MainPage()
{
InitializeComponent();
_watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
_watcher.MovementThreshold = 20;
_watcher.StatusChanged += (sender, args) =>
{
if (args.Status == GeoPositionStatus.Ready)
{
try
{
GeoCoordinate coordinates = _watcher.Position.Location;
DevCenterAds.Longitude = coordinates.Longitude;
DevCenterAds.Latitude = coordinates.Latitude;
}
finally
{
_watcher.Stop();
}
}
};
_watcher.Start();
LayoutUpdated += OnLayoutUpdated;
}