protected virtual void OnPositionUpdated(PositionUpdatedEventArgs e) { PositionUpdatedEventHandler handler = PositionUpdated; if (handler != null) { handler(this, e); } }
private void MapService_PositionUpdated(object sender, PositionUpdatedEventArgs e) { var distanceInKm = distanceService.CalculateDistanceBetweenPoints(e.PreviousPosition, e.CurrentPosition) / 1000; var interval = e.Timespan; var kmPerHour = this.speedService.CalculateSpeed(distanceInKm, interval); this.SpeedLabel.Text = $"Speed: {kmPerHour.ToString("0.00")} Km/h"; this.LatitudeLabel.Text = $"Latitude: {e.CurrentPosition.Lat.ToString("0.000")}"; this.LongitudeLabel.Text = $"Longitude: {e.CurrentPosition.Lng.ToString("0.000")}"; }