private async void Init() { try { var start = new Position(); start.Latitude = driver.Lat; start.Longitude = driver.Lon; this.destination = await Ride2GoService.GetPosition(this.destinationName); var routeResult = await Ride2GoService.GetRoute(start, destination, this.riderPosition); var points = routeResult.Locations; this.MapView.AddOverlay(MKPolyline.FromCoordinates(points)); var annotation = new BasicMapAnnotation(new CLLocationCoordinate2D(driver.Lat, driver.Lon), driver.Name); this.MapView.AddAnnotation(annotation); this.TimeLabel.Text = routeResult.Eta; this.timer = new Timer(); timer.Interval = 2500; timer.Start(); timer.Elapsed += this.TimerTick; } catch (Exception e) { Application.PresentOKAlert("hallo", e.Message, this, () => { }); } }
private async void DrawInitialRoute() { this.destinationPosition = await Ride2GoService.GetPosition(destination); var routeResult = await Ride2GoService.GetRoute(this.driverPosition, destinationPosition, null); this.firstRoute = MKPolyline.FromCoordinates(routeResult.Locations); this.MapView.AddOverlay(this.firstRoute); }