Bing Maps GetRoute 给出“0x8004231C"错误 [英] Bing Maps GetRoute gives '0x8004231C' error

查看:13
本文介绍了Bing Maps GetRoute 给出“0x8004231C"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 bing-maps 上显示从点到点的路线(在真实设备上测试).我已经输入了 2 个航点 (GeoCoordinate) 并且我正在尝试使用 await query.GetRouteAsync() 通过 Windows PhoneToolKit 获取路线.不幸的是,我收到一个未知错误:

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 Windows PhoneToolKit using the await query.GetRouteAsync(). Unfortunately, I'm getting an unknown error:

异步调用的结果:

'e.Result' threw an exception of type 'System.Reflection.TargetInvocationException'

内部异常:

Exception from HRESULT: 0x8004231C

我检查了 MSDN 网站 并注意到此错误代码未列在错误列表中...

I've checked the MSDN website and noticed that this errorcode is not listed in the errorlist...

相关代码如下.我使用了与 Windows Phone 工具包示例集中完全相同的代码,但删除了与获取路由无关的内容:

The related code is below. I've used the exact same code as in the sample set of the Windows Phone Toolkit, but removed the things which has nothing to do with getting the route:

    private async void BtnShowRoute_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    {
        try
        {
            RouteQuery query = new RouteQuery();
            List<GeoCoordinate> wayPoints = new List<GeoCoordinate>();

            wayPoints.Add(new GeoCoordinate(47.23449, -121.172447));
            wayPoints.Add(new GeoCoordinate(47.062638, -120.691795));

            query.Waypoints = wayPoints;

            Route route = await query.GetRouteAsync();

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
            throw;
        }
    }

我不知道这里出了什么问题.有没有其他人遇到过这个问题?如果是这样,你解决了吗?以及如何?

I have no idea what is going wrong here. Does anyone else experienced this issue? If so, did you resolve it? And how?

注意:我运行的是 Windows Phone 8.1.开发预览

Note: I'm running Windows Phone 8.1. Dev Preview

推荐答案

当底层服务调用在完成查询之前超时时会发生这种情况.希望这将在下一个版本中修复,但现在您可以使用以下代码:

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<GeoCoordinate> wayPoints = new List<GeoCoordinate>();

            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<Route> e)
        {
            try
            {
                Route myRoute = e.Result;
            }
            catch (TargetInvocationException)
            {
                Thread.Sleep(1000); // waiting for  completing the query
                    geoQ_QueryCompleted(sender, e);
            }

        }

这篇关于Bing Maps GetRoute 给出“0x8004231C"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆