public void SetLocation(MapLocation toLocation) { var targetLocation = toLocation.Location.To2D(); if (toLocation.Location.X == 0 && toLocation.Location.Y == 0) { // use the 'location manager' current coordinate if (locationManager.Location == null) { return; } { // catch a possible null reference that i saw once [CD] targetLocation = locationManager.Location.Coordinate; ConferenceAnnotation a = new ConferenceAnnotation(targetLocation, "My location", ""); mapView.AddAnnotationObject(a); } } else if (toLocation.Title == conf.Location.Title) { // no need to drop anything } else { // drop a new pin ConferenceAnnotation a = new ConferenceAnnotation(toLocation.Location.To2D(), toLocation.Title,toLocation.Subtitle); mapView.AddAnnotationObject(a); } mapView.CenterCoordinate = targetLocation; }
public void Flip(MapLocation toLocation) { mapView.SetLocation(toLocation); // assume not null, since it's created in ViewDidLoad ?? Flip(); }