/// <summary> /// Draws the walkable route to the spear, if the spear is unavailable /// </summary> public async void DrawWalkableRouteToSpear(Location playerLocation, Location spearLocation) { if (DirManager == null) { DirManager = Map.DirectionsManager; } DirManager.Waypoints.Clear(); DirManager.Waypoints.Add(new Waypoint(playerLocation)); DirManager.Waypoints.Add(new Waypoint(spearLocation)); DirManager.RequestOptions.RouteMode = RouteModeOption.Walking; DirManager.RequestOptions.Optimize = OptimizeOption.Walking; //Do something with the distance RouteResponse response = await DirManager.CalculateDirectionsAsync(); // not sure if merge conflict or not DirManager.RenderOptions.WaypointPushpinOptions.Visible = false; SpearHandler.Score.Distance = response.Routes[0].TravelDistance * 1000; SpearHandler.PropertyChanged(); //Manual f*** you to binding. if (response.HasError) { await SatanController.ShowMessageAsync("Route error", "The route could not be calculated."); } DirManager.ShowRoutePath(DirManager.ActiveRoute); }
public MapPage() { this.InitializeComponent(); _gelocator = new Geolocator(); _gelocator.StatusChanged += _gelocator_StatusChanged; _gelocator.PositionChanged += _gelocator_PositionChanged; _gelocator.DesiredAccuracy = PositionAccuracy.Default; _gelocator.MovementThreshold = 100; directionsManager = DirectionsMap.DirectionsManager; SetDirectionManagerOptions(); mapLayer = new MapLayer(); DirectionsMap.Children.Add(mapLayer); DirectionsMap.DirectionsManager.ActiveRouteChanged += DirectionsManager_ActiveRouteChanged; }
/// <summary> /// Sets up the Directionsmanagers properties /// </summary> private void setupDirectionsmanager() { directionsManager = Map.DirectionsManager; directionsManager.RequestOptions.RouteMode = RouteModeOption.Walking; directionsManager.RenderOptions.AutoUpdateMapView = false; }