private void MapControl_MapTapped(MapControl sender, MapInputEventArgs args)
 {
     MapClicked?.Invoke(this, new MapClickedEventArgs(
                            new Position(args.Location.Position.Latitude,
                                         args.Location.Position.Longitude)
                            ));
 }
Пример #2
0
        private void HandlerTap(object sender, TappedEventArgs e)
        {
            // Close all closable Callouts
            var list = _callouts.ToList();

            // First check all Callouts, that belong to a pin
            foreach (var pin in _pins)
            {
                if (pin.Callout != null)
                {
                    if (pin.Callout.IsClosableByClick)
                    {
                        pin.IsCalloutVisible = false;
                    }
                    list.Remove(pin.Callout);
                }
            }

            // Now check the rest, Callouts not belonging to a pin
            foreach (var c in list)
            {
                if (c.IsClosableByClick)
                {
                    HideCallout(c);
                }
            }

            e.Handled = false;

            // Check, if we hit a widget or drawable
            // Is there a widget at this position
            // Is there a drawable at this position
            if (Map != null)
            {
                var mapInfo = _mapControl.GetMapInfo(e.ScreenPosition);

                if (mapInfo.Feature == null)
                {
                    var args = new MapClickedEventArgs(_mapControl.Viewport.ScreenToWorld(e.ScreenPosition).ToForms(), e.NumOfTaps);

                    MapClicked?.Invoke(this, args);

                    if (args.Handled)
                    {
                        e.Handled = true;
                        return;
                    }

                    // Event isn't handled up to now.
                    // Than look, what we could do.

                    return;
                }

                // A feature is clicked
                HandlerInfo(sender, new MapInfoEventArgs {
                    MapInfo = mapInfo, Handled = e.Handled, NumTaps = e.NumOfTaps
                });
            }
        }
        protected override void OnAttached()
        {
            mapView = Control as MKMapView;
            if (mapView == null)
            {
                throw new NotSupportedException(Control.GetType() + " is not supported.");
            }

            behavior = (Element as Map)?.Behaviors?.OfType <ClickBehavior>()?.FirstOrDefault();
            if (behavior == null)
            {
                return;
            }

            tapGesture = new UITapGestureRecognizer(recognizer =>
                                                    MapClicked?.Invoke(this, new MapClickedEventArgs(
                                                                           ConvertLocationToPosition(recognizer, mapView)))
                                                    )
            {
                NumberOfTapsRequired = 1,
            };

            longPressGesture = new UILongPressGestureRecognizer(recognizer =>
            {
                if (recognizer.State != UIGestureRecognizerState.Began)
                {
                    return;
                }

                MapLongClicked?.Invoke(this, new MapClickedEventArgs(
                                           ConvertLocationToPosition(recognizer, mapView)));
            });

            tapGesture.RequireGestureRecognizerToFail(longPressGesture);
            mapView.AddGestureRecognizer(longPressGesture);
            mapView.AddGestureRecognizer(tapGesture);
        }
Пример #4
0
 internal void SendMapClicked(Position point)
 {
     MapClicked?.Invoke(this, new MapClickedEventArgs(point));
 }
 private void GoogleMap_MapClick(object sender, GoogleMap.MapClickEventArgs e)
 {
     MapClicked?.Invoke(this, new MapClickedEventArgs(
                            new Position(e.Point.Latitude,
                                         e.Point.Longitude)));
 }
Пример #6
0
 public void SendMapClicked(Position position) => MapClicked?.Invoke(this, new MapClickedEventArgs(position));
 protected virtual void OnMapClicked(EventArgs e)
 {
     MapClicked?.Invoke(this, e);
 }
Пример #8
0
 private void MapClick(string id, float latitude, float longitude, int radius)
 {
     MapClicked?.Invoke(this, new MapEventArgs(id, latitude, longitude, radius));
 }
Пример #9
0
        /// <summary>
        /// Raises <see cref="MapClicked"/>
        /// </summary>
        /// <param name="position">The position on the map</param>
        protected void OnMapClicked(Position position)
        {
            MapClicked?.Invoke(this, new TKGenericEventArgs <Position>(position));

            RaiseCommand(MapClickedCommand, position);
        }
Пример #10
0
 internal void mapClicked(Position position)
 {
     MapClicked?.Invoke(this, position);
 }
Пример #11
0
 private void OnMapClicked(object sender, MapClickedEventArgs e)
 {
     MapClicked?.Invoke(this, new MapClickedEventArgs(e.Position));
     MapClidkedCommand?.ExecuteIfPossible(new MapClickedEventArgs(e.Position));
 }