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();
}