Skip to main content

BingRouteResult Class

OBSOLETE

This class is obsolete. Microsoft deprecated Bing Maps on June 30th, 2025. For alternative providers, see https://www.devexpress.com/bing-maps-wpf

Contains results of a request to the Microsoft Bing web service for route calculation.

Namespace: DevExpress.Xpf.Map

Assembly: DevExpress.Xpf.Map.v25.1.dll

NuGet Package: DevExpress.Wpf.Map

Declaration

[Obsolete("This class is obsolete. Microsoft deprecated Bing Maps on June 30th, 2025. For alternative providers, see https://www.devexpress.com/bing-maps-wpf")]
[PreferableMember("BingRouteResult", "", "")]
public class BingRouteResult

Example

private void routeDataProvider_RouteCalculated(object sender, BingRouteCalculatedEventArgs e) {
    RouteCalculationResult result = e.CalculationResult;

    StringBuilder resultList = new StringBuilder();
    resultList.Append(String.Format("Status: {0}\n", result.ResultCode));
    resultList.Append(String.Format("Fault reason: {0}\n", result.FaultReason));
    resultList.Append(ProcessIntermediatePoints(result.IntermediatePoints));
    resultList.Append(ProcessRouteResults(result.RouteResults));

    tbResults.Text = resultList.ToString();
}
string ProcessIntermediatePoints(List<RouteWaypoint> points) {
    if (points == null) return "";

    StringBuilder sb = new StringBuilder("Intermediate Points:\n"); 
    sb.Append(String.Format("_________________________\n"));
    for (int i = 0; i < points.Count; ++i)
            sb.Append(String.Format(
                "Intermediate point {0}: {1} ({2})\n", 
                i+1,
                points[i].Description, 
                points[i].Location
            ));
    return sb.ToString();
}
string ProcessRouteResults(List<BingRouteResult> results) {
    if (results == null) return "";

    StringBuilder sb = new StringBuilder("RouteResults:\n");
    for (int i = 0; i < results.Count; i++) {
        sb.Append(String.Format("_________________________\n"));
        sb.Append(String.Format("Path {0}:\n", i+1));
        sb.Append(String.Format("Distance: {0}\n", results[i].Distance));
        sb.Append(String.Format("Time: {0}\n", results[i].Time));
        sb.Append(ProcessLegs(results[i].Legs));
    }
    return sb.ToString();
}
string ProcessLegs(List<BingRouteLeg> legs) {
    if (legs == null) return "";

    StringBuilder sb = new StringBuilder("Legs:\n");    
    for (int i = 0; i < legs.Count; i++) {
        sb.Append(String.Format("\tLeg {0}:\n", i+1));
        sb.Append(String.Format("\tStart: {0}\n", legs[i].StartPoint));
        sb.Append(String.Format("\tEnd: {0}\n", legs[i].EndPoint));
        sb.Append(String.Format("\tDistance: {0}\n", legs[i].Distance));
        sb.Append(String.Format("\tTime: {0}\n", legs[i].Time));
        sb.Append(ProcessItinerary(legs[i].Itinerary));
    }
    return sb.ToString();
}
string ProcessWarnings(List<BingItineraryItemWarning> warnings) {
    if (warnings == null) return "";

    StringBuilder sb = new StringBuilder("\t\tWarnings:\n");
    for (int i = 0; i < warnings.Count; i++) {
        sb.Append(String.Format("\t\t\tWarning {0}:\n", i + 1));
        sb.Append(String.Format("\t\t\tType: {0}\n", warnings[i].Type));
        sb.Append(String.Format("\t\t\tText: {0}\n", warnings[i].Text));

    }
    return sb.ToString();
}

Inheritance

Object
BingRouteResult
See Also