/// <summary> /// When view is tapped, identify the room, or if a route is in progress, give the user the option to ignore /// </summary> private async void MapView_GeoViewTapped(object sender, GeoViewInputEventArgs e) { try { // Wait for double tap to fire await Task.Delay(500); // If view has been double tapped, set tapped to handled and flag back to false if (_isViewDoubleTapped) { e.Handled = true; _isViewDoubleTapped = false; } else { // If route card is visible, do not dismiss route if (_viewModel.CurrentState == UiState.RouteFound) { // Create a new Alert Controller UIAlertController actionSheetAlert = UIAlertController.Create(null, null, UIAlertControllerStyle.ActionSheet); // Add Actions actionSheetAlert.AddAction(UIAlertAction.Create("ClearExistingRouteButtonText".Localize(), UIAlertActionStyle.Destructive, (action) => _viewModel.CloseRouteResult())); actionSheetAlert.AddAction(UIAlertAction.Create("KeepExistingRouteButtonText".Localize(), UIAlertActionStyle.Default, null)); // Required for iPad - You must specify a source for the Action Sheet since it is // displayed as a popover UIPopoverPresentationController presentationPopover = actionSheetAlert.PopoverPresentationController; if (presentationPopover != null) { presentationPopover.SourceView = _bottomSheet.DisplayedContentView; presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up; } // Display the alert PresentViewController(actionSheetAlert, true, null); } else { // Identify a layer using MapView, passing in the layer, the tap point, tolerance, types to return, and max result IdentifyLayerResult idResults = await _mapView.IdentifyLayerAsync( layer : _mapView.Map.OperationalLayers[AppSettings.CurrentSettings.RoomsLayerIndex], screenPoint : e.Position, tolerance : 10, returnPopupsOnly : false, maximumResults : 1); // Call on the viewmodel to handle the identify result _viewModel.IdentifyRoomFromLayerResult(idResults); } } } catch (Exception ex) { ErrorLogger.Instance.LogException(ex); } }
/// <summary> /// Forwards event to viewmodel /// </summary> private void Close_Clicked(object sender, EventArgs e) => _viewModel.CloseRouteResult();