Windows Phone 离线路由
Windows Phone Offline routing
我正在尝试制作具有离线路由的 windows phone 应用程序。我发现使用 Bing API 是可能的。
我注册了,拿到了key,但是找不到,怎么用
我正在使用以下代码:
private async void Button_Click(object sender, RoutedEventArgs 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.QueryAsync();
}
private void geoQ_QueryCompleted(object sender, QueryCompletedEventArgs<Route> e)
{
try
{
Route myRoute = e.Result;
MessageBox.Show("Completed");
}
catch (TargetInvocationException)
{
/// Unauthorized access exception 0x8004231C
Thread.Sleep(1000); // waiting for completing the query
geoQ_QueryCompleted(sender, e);
}
}
但我收到未经授权的访问异常 0x8004231C。
想请教一下,我该如何解决?
您不需要密钥即可显示离线地图。如果您在设备上下载了地图,则离线路线应该可以使用。您可以查看 sample 以获取更多详细信息。
以下引用自 msdn 示例,
However, mapping services also work without Internet connectivity when maps are downloaded for offline use.
我正在尝试制作具有离线路由的 windows phone 应用程序。我发现使用 Bing API 是可能的。 我注册了,拿到了key,但是找不到,怎么用
我正在使用以下代码:
private async void Button_Click(object sender, RoutedEventArgs 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.QueryAsync();
}
private void geoQ_QueryCompleted(object sender, QueryCompletedEventArgs<Route> e)
{
try
{
Route myRoute = e.Result;
MessageBox.Show("Completed");
}
catch (TargetInvocationException)
{
/// Unauthorized access exception 0x8004231C
Thread.Sleep(1000); // waiting for completing the query
geoQ_QueryCompleted(sender, e);
}
}
但我收到未经授权的访问异常 0x8004231C。 想请教一下,我该如何解决?
您不需要密钥即可显示离线地图。如果您在设备上下载了地图,则离线路线应该可以使用。您可以查看 sample 以获取更多详细信息。
以下引用自 msdn 示例,
However, mapping services also work without Internet connectivity when maps are downloaded for offline use.