LondonBike.TripLog.SetLocation C# (CSharp) Method

SetLocation() public method

public SetLocation ( double lat, double lon, bool isStart ) : void
lat double
lon double
isStart bool
return void
        public void SetLocation(double lat, double lon, bool isStart)
        {
            if (isStart) {
                StartLat = lat;
                StartLon = lon;
            } else {
                EndLat = lat;
                EndLon = lon;
            }
        }

Usage Example

Example #1
0
        public static void GetCurrentLocation(TripLog currentLog, bool isStart, NSAction onFound)
        {
            if (!CLLocationManager.LocationServicesEnabled)
            {
                currentLog.SetLocation(-1, -1, isStart);

                onFound();
            }

            locationManager = new CLLocationManager();
            locationManager.DesiredAccuracy = CLLocation.AccuracyNearestTenMeters;

            locationDelegate = new MyLocationManagerDelegate();

            locationDelegate.OnLocationError += delegate(NSError error) {
                currentLog.SetLocation(-1, -1, isStart);
                locationManager.StopUpdatingLocation();
                onFound();
            };

            locationDelegate.OnLocationUpdate += delegate(CLLocation location) {
                currentLog.SetLocation(location.Coordinate.Latitude, location.Coordinate.Longitude, isStart);
                locationManager.StopUpdatingLocation();

                onFound();
            };

            locationManager.Delegate = locationDelegate;


            locationManager.StartUpdatingLocation();
            locationDelegate.StartTimer(locationManager);
            Util.TurnOnNetworkActivity();
        }
All Usage Examples Of LondonBike.TripLog::SetLocation