public CoordinateReadoutController(MapView mapView, MapViewModel mapViewModel)
        {
            _mapView = mapView;
            _mapViewModel = mapViewModel;

            _mapView.MouseMove += mapView_MouseMove;

            Mediator.Register(Constants.ACTION_COORDINATE_READOUT_FORMAT_CHANGED, OnCoordinateReadoutFormatChanged);
        }
        public ViewShedToolController(MapView mapView, MapViewModel mapViewModel)
        {
            _viewShedToolView = new ViewShedToolView { ViewModel = { mapView = mapView } };

            var owner = Window.GetWindow(mapView);

            if (owner != null)
            {
                _viewShedToolView.Owner = owner;
            }

            mapView.GraphicsOverlays.Add(new GraphicsOverlay() { ID = "inputOverlay", Renderer = _viewShedToolView.LayoutRoot.Resources["PointRenderer"] as Renderer });
            mapView.GraphicsOverlays.Add(new GraphicsOverlay() { ID = "ViewshedOverlay", Renderer = _viewShedToolView.LayoutRoot.Resources["ViewshedRenderer"] as Renderer });
        }
        public GotoXYToolController(MapView mapView, MapViewModel mapViewModel)
        {
            _mapView = mapView;

            _gotoXyToolView = new GotoXYToolView { ViewModel = { mapView = mapView } };

            var owner = Window.GetWindow(mapView);

            if (owner != null)
            {
                _gotoXyToolView.Owner = owner;
            }

            Mediator.Register(Constants.ACTION_GOTO_XY_COORDINATES, OnGotoXYCoordinates);
        }
        public ViewShedToolController(MapView mapView, MapViewModel mapViewModel)
        {
            _viewShedToolView = new ViewShedToolView {PlacementTarget = mapView, ViewModel = {mapView = mapView}};

            var owner = Window.GetWindow(mapView);

            if (owner != null)
            {
                owner.LocationChanged += (sender, e) =>
                {
                    _viewShedToolView.HorizontalOffset += 1;
                    _viewShedToolView.HorizontalOffset -= 1;
                };
            }

            mapView.GraphicsOverlays.Add(new GraphicsOverlay() { ID = "inputOverlay", Renderer = _viewShedToolView.LayoutRoot.Resources["PointRenderer"] as Renderer });
            mapView.GraphicsOverlays.Add(new GraphicsOverlay() { ID = "ViewshedOverlay", Renderer = _viewShedToolView.LayoutRoot.Resources["ViewshedRenderer"] as Renderer });
        }
        public GotoXYToolController(MapView mapView, MapViewModel mapViewModel)
        {
            _mapView = mapView;

            _gotoXyToolView = new GotoXYToolView {PlacementTarget = mapView, ViewModel = {mapView = mapView}};

            var owner = Window.GetWindow(mapView);

            if (owner != null)
            {
                owner.LocationChanged += (sender, e) =>
                    {
                        _gotoXyToolView.HorizontalOffset += 1;
                        _gotoXyToolView.HorizontalOffset -= 1;
                    };
            }

            Mediator.Register(Constants.ACTION_GOTO_XY_COORDINATES, OnGotoXYCoordinates);
        }
        public NetworkingToolController(MapView mapView, MapViewModel mapViewModel)
        {
            this._mapView = mapView;

            _networkingToolView = new NetworkingToolView {PlacementTarget = mapView, ViewModel = {mapView = mapView}};

            var owner = Window.GetWindow(mapView);

            if (owner != null)
            {
                owner.LocationChanged += (sender, e) =>
                {
                    _networkingToolView.HorizontalOffset += 1;
                    _networkingToolView.HorizontalOffset -= 1;
                };
            }

            // hook mapview events
            mapView.MapViewTapped += mapView_MapViewTapped;
            mapView.MapViewDoubleTapped += mapView_MapViewDoubleTapped;

            // hook listDirections
            _networkingToolView.listDirections.SelectionChanged += listDirections_SelectionChanged;

            // hook view resources
            _directionPointSymbol = _networkingToolView.LayoutRoot.Resources["directionPointSymbol"] as Symbol;

            mapView.GraphicsOverlays.Add(new GraphicsOverlay { ID="RoutesOverlay", Renderer=_networkingToolView.LayoutRoot.Resources["routesRenderer"] as Renderer});
            mapView.GraphicsOverlays.Add(new GraphicsOverlay { ID="StopsOverlay" });
            mapView.GraphicsOverlays.Add(new GraphicsOverlay { ID = "DirectionsOverlay", Renderer=_networkingToolView.LayoutRoot.Resources["directionsRenderer"] as Renderer, SelectionColor=Colors.Red });

            _stopsOverlay = mapView.GraphicsOverlays["StopsOverlay"];
            _routesOverlay = mapView.GraphicsOverlays["RoutesOverlay"];
            _directionsOverlay = mapView.GraphicsOverlays["DirectionsOverlay"];

            _routeTask = new OnlineRouteTask(new Uri(OnlineRoutingService));

            Mediator.Register(Constants.ACTION_ROUTING_GET_DIRECTIONS, DoGetDirections);

            _locatorTask = new OnlineLocatorTask(new Uri(OnlineLocatorUrl)) {AutoNormalize = true};
        }