BuildItArSample.iOS.ViewController.LocationManager_LocationsUpdated C# (CSharp) Метод

LocationManager_LocationsUpdated() приватный Метод

private LocationManager_LocationsUpdated ( object sender, CLLocationsUpdatedEventArgs e ) : void
sender object
e CLLocationsUpdatedEventArgs
Результат void
        private void LocationManager_LocationsUpdated(object sender, CLLocationsUpdatedEventArgs e)
        {
            try
            {
                var position = e.Locations?.FirstOrDefault();
                if (position == null)
                {
                    return;
                }
                var currentLocation = new Location {Latitude = position.Coordinate.Latitude, Longitude = position.Coordinate.Longitude};
                world.UpdateLocation(currentLocation);
                foreach (var view in events.Keys)
                {
                    var poi = events[view];
                    poi.Element.DistanceMetres = currentLocation.DistanceInMetres(poi.Element.GeoLocation);
                    var distanceLabel = view.Subviews?.FirstOrDefault(v => v is UILabel) as UILabel;
                    if (distanceLabel == null) continue;
                    var distance = events[view].Element.DistanceAway;
                    distanceLabel.Text = distance;
                    var frameWidth = distanceLabel.IntrinsicContentSize.Width;
                    distanceLabel.Frame = new CGRect(0, 0, frameWidth, 15);
                    view.Bounds = new CGRect(0, 0, frameWidth, 50);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }