private void EndingPointReceived(Mobica.GeocodeService.GeocodeResult coordinates) { try { //MessageBox.Show("Current location:" + curentLocation.Latitude + " " + curentLocation.Longitude); endPoint = coordinates; System.Device.Location.GeoCoordinate curentLocation = GPS.currentCoordinate; GeocodeResult currentPoint = new GeocodeResult(); { currentPoint.Locations = new System.Collections.ObjectModel.ObservableCollection<Mobica.GeocodeService.GeocodeLocation>(); currentPoint.Locations.Add(new GeocodeService.GeocodeLocation()); currentPoint.Locations[0].Latitude = curentLocation.Latitude; currentPoint.Locations[0].Longitude = curentLocation.Longitude; currentPoint.DisplayName = "You are here"; } //MessageBox.Show("I've got it!" + endPoint.Locations[0].Latitude + " " + endPoint.Locations[0].Longitude); TravelMode tm = TravelMode.Driving; if (_sets.GetValue("RouteMode") == "Walking mode") tm = TravelMode.Walking; bmh.CalculateRoute(map1, new GeocodeResult[] { currentPoint, endPoint }, RutedMapReceived, tm); } catch (NullReferenceException e) { MessageBox.Show("Position in GPS does not exist: " + e.Message); } }
private RouteService.Waypoint GeoCodeResultToWaypoint(GeocodeService.GeocodeResult result) { RouteService.Waypoint waypoint = new RouteService.Waypoint(); waypoint.Description = result.DisplayName; waypoint.Location = new Location(); waypoint.Location.Latitude = result.Locations[0].Latitude; waypoint.Location.Longitude = result.Locations[0].Longitude; return(waypoint); }
private void StartingPointReceived(Mobica.GeocodeService.GeocodeResult coordinates) { startPoint = coordinates; //MessageBox.Show("I've got it!" + startPoint.Locations[0].Latitude + " " + startPoint.Locations[0].Longitude); }