Beispiel #1
0
        ///// <summary> Event handler for clicking with the right mouse on a way point pin. </summary>
        ///// <param name="sender"> The sender of the MouseRightButtonDown event. </param>
        ///// <param name="e"> The event parameters. </param>
        //private void pin_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        //{
        //    selectedElement = sender as FrameworkElement;
        //    e.Handled = false;
        //}

        /// <summary> Event handler for a right click in the map. </summary>
        /// <param name="sender"> The sender of the MouseRightButtonDown event. </param>
        /// <param name="e"> The event parameters. </param>
        #region doc:save the click point
        private void wpfMap_MapMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            System.Windows.Point p = _wpfMap.MouseToGeo(e, "PTV_MERCATOR");
            clickPoint = new PlainPoint {
                x = p.X, y = p.Y
            };

            e.Handled = false;
        }
        private async void toolTipTimer_Tick(object sender, EventArgs ea)
        {
            toolTipTimer.Stop();

            var e = toolTipTimer.Tag as System.Windows.Input.MouseEventArgs;

            var geo = map.MouseToGeo(e);

            if (tooltip == null)
            {
                tooltip = new System.Windows.Controls.ToolTip();
            }

            var result = await Task.Run(() => ReverseLocatingFunc(geo.X, geo.Y));

            if (result == null)
            {
                return;
            }

            var toolTipString = result.Country;

            if (map.Zoom > 4 && !string.IsNullOrEmpty(result.City))
            {
                toolTipString += "\n" + result.City;
            }

            if (map.Zoom > 10 && !string.IsNullOrEmpty(result.Street))
            {
                toolTipString += "\n" + result.Street;
            }

            if (string.IsNullOrEmpty(toolTipString))
            {
                return;
            }

            tooltip.Content = toolTipString;
            tooltip.IsOpen  = true;
        }