Bing Maps GetRoute gives '0x8004231C' error

前端 未结 1 1258
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-15 22:51

I\'m trying to show a route from point-to-point on the bing-maps (testing on real device). I\'ve entered 2 waypoints (GeoCoordinate) and I\'m trying to get the route via the

1条回答
  •  广开言路
    2021-01-15 23:32

    This happens when the underlying service call times out before completing the query. Hopefully this will be fixed in next version , but for now you can use following code:

    private async void BtnShowRoute_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
                RouteQuery query = new RouteQuery();
                List wayPoints = new List();
    
                wayPoints.Add(new GeoCoordinate(47.23449, -121.172447));
                wayPoints.Add(new GeoCoordinate(47.062638, -120.691795));
    
                query.Waypoints = wayPoints;
       query .QueryCompleted += geoQ_QueryCompleted;
                query.GetRouteAsync();
    
    
        }  
     private void geoQ_QueryCompleted(object sender, QueryCompletedEventArgs e)
            {
                try
                {
                    Route myRoute = e.Result;
                }
                catch (TargetInvocationException)
                {
                    Thread.Sleep(1000); // waiting for  completing the query
                        geoQ_QueryCompleted(sender, e);
                }
    
            }
    

    0 讨论(0)
提交回复
热议问题