protected void OnPositionChanged(LocationChangedEventArgs e) { var handler = PositionChanged; if (handler != null) { handler(this, e); } IsLocationKnown = true; }
protected void OnPositionChanged(object sender, LocationChangedEventArgs args) { // we need to listen to location change event twice because if application is launched // and device location is changed since last launch, 1st event is fired with previous coordinates (is this an emulator issue?). Interlocked.Increment(ref this.locationChangeListenCount); if (this.locationChangeListenCount == locationChangeListenCountMax) { DeviceLocationInfo.Current.PositionChanged -= OnPositionChanged; } RefreshList(); }
private void OnGeoCoordinateWatcherPositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e) { var args = new LocationChangedEventArgs { Coordinates = e.Position.Location }; if (this.CurrentCoordinates == e.Position.Location) { args.IsDuplicate = true; } this.CurrentCoordinates = e.Position.Location; OnPositionChanged(args); }