/// <summary> /// Fields the selected. /// </summary> /// <param name="sender">The sender of the selected field.</param> /// <param name="e">The arguments of the selected field event.</param> private void FieldSelected(object sender, FieldSelectedEventArgs e) { this.SelectedField = e.Field; }
/// <summary> /// Fields the selected. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">E event.</param> public void FieldSelected(object sender, FieldSelectedEventArgs e) { if (this.Map != null) { var builder = new LatLngBounds.Builder(); var whc = GeoHelper.CalculateBoundingBox(e.Field.BoundingCoordinates); double width = whc.Width * 0.95; double height = whc.Height * 0.59; builder.Include(new LatLng(whc.Center.Latitude - width, whc.Center.Longitude - height)); builder.Include(new LatLng(whc.Center.Latitude + width, whc.Center.Longitude + height)); var bounds = builder.Build(); this.Map.MoveCamera(CameraUpdateFactory.NewLatLngBounds(bounds, 0)); } }
/// <summary> /// Gets called when a field is selected. /// </summary> /// <param name="sender">Sender who fired the event.</param> /// <param name="e">Event Arguments.</param> protected void FieldSelected(object sender, FieldSelectedEventArgs e) { if (this.mapView != null) { var widthHeight = GeoHelper.CalculateBoundingBox(e.Field.BoundingCoordinates); var center = widthHeight.Center; var coords = new CLLocationCoordinate2D(center.Latitude, center.Longitude); var span = new MKCoordinateSpan(widthHeight.Width * 1.1, widthHeight.Height * 1.1); this.mapView.Region = new MKCoordinateRegion(coords, span); } }