C# 无法在MapControl(Windows Phone 8.1)上绘制路由

C# 无法在MapControl(Windows Phone 8.1)上绘制路由,c#,windows-phone-8,windows-phone-8.1,C#,Windows Phone 8,Windows Phone 8.1,我需要在地图控件上的两点之间绘制一条驾驶路线(我正在为Windows Phone 8.1执行此操作)。我用MSDN的教程做了所有的事情,但它不起作用-路径是空的。我做错了什么?这是密码 BasicGeoposition startLocation = new BasicGeoposition(); startLocation.Latitude = 40.7517; startLocation.Longitude = -073.9766; Geopoint startPoint = new Geo

我需要在地图控件上的两点之间绘制一条驾驶路线(我正在为Windows Phone 8.1执行此操作)。我用MSDN的教程做了所有的事情,但它不起作用-路径是空的。我做错了什么?这是密码

BasicGeoposition startLocation = new BasicGeoposition();
startLocation.Latitude = 40.7517;
startLocation.Longitude = -073.9766;
Geopoint startPoint = new Geopoint(startLocation);

// End at Central Park in New York City.
BasicGeoposition endLocation = new BasicGeoposition();
endLocation.Latitude = 40.7669;
endLocation.Longitude = -073.9790;
Geopoint endPoint = new Geopoint(endLocation);

// Get the route between the points.
MapRouteFinderResult routeResult =
    await MapRouteFinder.GetDrivingRouteAsync(
    startPoint,
    endPoint,
    MapRouteOptimization.Time,
    MapRouteRestrictions.None,
    290
    );


MapRouteView viewOfRoute = new MapRouteView(routeResult.Route);
viewOfRoute.RouteColor = Colors.Blue;
viewOfRoute.OutlineColor = Colors.Blue;

// Add the new MapRouteView to the Routes collection
// of the MapControl.
mapeczka.Routes.Add(viewOfRoute);

// Fit the MapControl to the route.
await mapeczka.TrySetViewBoundsAsync(
    routeResult.Route.BoundingBox,
    null,
    Windows.UI.Xaml.Controls.Maps.MapAnimationKind.Bow);

if (routeResult.Status == MapRouteFinderStatus.Success)
{
    // Use the route to initialize a MapRouteView.
    viewOfRoute = new MapRouteView(routeResult.Route);
    viewOfRoute.RouteColor = Colors.Yellow;
    viewOfRoute.OutlineColor = Colors.Black;

    // Add the new MapRouteView to the Routes collection
    // of the MapControl.

}
mapeczka.Routes.Add(viewOfRoute);
// Fit the MapControl to the route.
await mapeczka.TrySetViewBoundsAsync(
    routeResult.Route.BoundingBox,
    null,
    Windows.UI.Xaml.Controls.Maps.MapAnimationKind.None);

你能说得更具体些吗?我想你正在使用一些第三方库来实现这一点。我尝试了你的代码,它对我来说非常适合。您是否正确设置了ApplicationID和AuthenticationToken?我还看到你的代码中有一些冗余(最后一部分是上面代码的副本)。我对Windows Phone完全陌生,但我正在学习:)幸运的是我不必支付代币-我从我的Dreamspark帐户获得了代币:)我也有同样的问题。地图上没有显示路线,我有一个令牌。问题到底出在哪里。我使用相同的代码..我根据本教程做了所有事情。-别忘了编辑package.appxmanifest文件。