private void MapControl_MapHolding(MapControl sender, MapInputEventArgs args)
 {
     MapLongClicked?.Invoke(this, new MapClickedEventArgs(
                                new Position(args.Location.Position.Latitude,
                                             args.Location.Position.Longitude)
                                ));
 }
示例#2
0
文件: MapView.cs 项目: anke522/Mapsui
        private void HandlerLongTap(object sender, TappedEventArgs e)
        {
            var args = new MapLongClickedEventArgs(_mapControl.Viewport.ScreenToWorld(e.ScreenPosition).ToForms());

            MapLongClicked?.Invoke(this, args);

            if (args.Handled)
            {
                e.Handled = true;
            }
        }
        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 SendMapLongClicked(Position point)
 {
     MapLongClicked?.Invoke(this, new MapLongClickedEventArgs(point));
 }
 private void GoogleMap_MapLongClick(object sender, GoogleMap.MapLongClickEventArgs e)
 {
     MapLongClicked?.Invoke(this, new MapClickedEventArgs(
                                new Position(e.Point.Latitude,
                                             e.Point.Longitude)));
 }
示例#6
0
 private void OnMapLongClicked(object sender, MapClickedEventArgs e)
 {
     MapLongClicked?.Invoke(this, new MapClickedEventArgs(e.Position));
     MapLongClidkedCommand?.ExecuteIfPossible(new MapClickedEventArgs(e.Position));
 }