// Handle the selection event for the picker. public override void Selected(UIPickerView pickerView, nint row, nint component) { // Get the selected datum transformation factor. _selectedTransformation = _datumTransformations[(int)pickerView.SelectedRowInComponent(0)]; // Raise the selection event (with the new transformation) so listeners can handle it. EventHandler <TransformationSelectionEventArgs> selectionEventHandler = TransformationSelected; if (selectionEventHandler != null) { TransformationSelectionEventArgs args = new TransformationSelectionEventArgs(_selectedTransformation); selectionEventHandler(this, args); } }
// Handle selection events in the transformation picker. private void TransformationsPicker_TransformationSelected(object sender, TransformationSelectionEventArgs e) { // Get the selected transform from the event arguments. Return if none is selected. DatumTransformation selectedTransform = e.Transformation; if (selectedTransform == null) { return; } try { // Project the original point using the selected transform. MapPoint projectedPoint = (MapPoint)GeometryEngine.Project(_originalPoint, _myMapView.SpatialReference, selectedTransform); // Update the projected graphic (if it already exists), create it otherwise. if (_projectedPointGraphic != null) { _projectedPointGraphic.Geometry = projectedPoint; } else { // Create a symbol to represent the projected point (a cross to ensure both markers are visible). SimpleMarkerSymbol projectedPointMarker = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Cross, Color.Red, 15); // Create the point graphic and add it to the overlay. _projectedPointGraphic = new Graphic(projectedPoint, projectedPointMarker); _pointsOverlay.Graphics.Add(_projectedPointGraphic); } _messagesTextView.Text = "Projected point using transform: " + selectedTransform.Name; } catch (ArcGISRuntimeException ex) { // Exception if a transformation is missing grid files. _messagesTextView.Text = "Error using selected transformation: " + ex.Message; // Remove the projected point graphic (if it exists). if (_projectedPointGraphic != null && _pointsOverlay.Graphics.Contains(_projectedPointGraphic)) { _pointsOverlay.Graphics.Remove(_projectedPointGraphic); _projectedPointGraphic = null; } } }