Ejemplo n.º 1
0
        internal bool SendPinClicked(Pin pin)
        {
            var args = new PinClickedEventArgs(pin);

            PinClicked?.Invoke(this, args);
            return(args.Handled);
        }
Ejemplo n.º 2
0
 public void HandleClick()
 {
     if (PinClicked != null)
     {
         PinClicked.Invoke(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 3
0
        private void HandlerInfo(object sender, MapInfoEventArgs e)
        {
            // Click on pin?
            Pin clickedPin = null;

            foreach (var pin in _pins)
            {
                if (pin.IsVisible && pin.Feature.Equals(e.MapInfo.Feature))
                {
                    clickedPin = pin;
                    break;
                }
            }

            if (clickedPin != null)
            {
                SelectedPin = clickedPin;

                SelectedPinChanged?.Invoke(this, new SelectedPinChangedEventArgs(SelectedPin));

                var pinArgs = new PinClickedEventArgs(clickedPin, _mapControl.Viewport.ScreenToWorld(e.MapInfo.ScreenPosition).ToForms(), e.NumTaps);

                PinClicked?.Invoke(this, pinArgs);

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

            // Check for clicked drawables
            var drawables = GetDrawablesAt(_mapControl.Viewport.ScreenToWorld(e.MapInfo.ScreenPosition), _mapDrawableLayer);

            var drawableArgs = new DrawableClickedEventArgs(
                _mapControl.Viewport.ScreenToWorld(e.MapInfo.ScreenPosition).ToForms(),
                new Point(e.MapInfo.ScreenPosition.X, e.MapInfo.ScreenPosition.Y), e.NumTaps);

            // Now check each drawable until one handles the event
            foreach (var drawable in drawables)
            {
                drawable.HandleClicked(drawableArgs);

                if (!drawableArgs.Handled)
                {
                    continue;
                }
                e.Handled = true;
                return;
            }

            // Call Info event, if there is one
            Info?.Invoke(sender, e);
        }
Ejemplo n.º 4
0
        void HandlePress(object sender, EventArgs args)
        {
            // If alternate UI is shown then a press activates the pin
            if (AllowPinning && mouseOver)
            {
                Pinned = !pinned;

                QueueDraw();
                PinClicked?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                WelcomePageSection.DispatchLink(actionUrl);
            }
        }
Ejemplo n.º 5
0
        private void _webView_WebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs e)
        {
            var message = JsonSerializer.Deserialize <WebViewEventMessage>(e.WebMessageAsJson, new JsonSerializerOptions()
            {
                PropertyNameCaseInsensitive = true
            });

            if (message.Event == "BingMapLoaded")
            {
                BingMapLoaded?.Invoke(this, new EventArgs());
            }
            else if (message.Event == "PinClicked")
            {
                var id = Guid.Parse(message.Parameter);
                PinClicked?.Invoke(this, new PinClickedEventArgs(id));
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Send the pin clicked event.
 /// </summary>
 internal void SendPinClicked(IMapAnnotation pin)
 {
     PinClicked?.Invoke(this, new MapEventArgs <IMapAnnotation>(pin));
 }