Direction.Action Property

The action (DirectionAction enumeration) for the specified direction.

Public Dim Action As [Namespace].DirectionAction
    Member of [Namespace].Direction
[C#]
public [Namespace].DirectionAction Action
    Member of [Namespace].Direction

Example

 
[Visual Basic] 
'This example assumes that the service instance 
''routeService' has already been created and that 
'the MapPoint Web Service namespace has been imported 

'Calculate a route and add a note for construction
Dim latLongs(1) As LatLong
latLongs(0) = New LatLong()
latLongs(0).Latitude = 40
latLongs(0).Longitude = -120
latLongs(1) = New LatLong()
latLongs(1).Latitude = 41
latLongs(1).Longitude = -121

Dim myRoute As Route
myRoute = routeService.CalculateSimpleRoute(latLongs, "MapPoint.NA", SegmentPreference.Quickest)

Dim i As Integer
For i = 0 To myRoute.Itinerary.Segments(0).Directions.Length - 1
    If (myRoute.Itinerary.Segments(0).Directions(i).Action = DirectionAction.ConstructionDelay _
        Or myRoute.Itinerary.Segments(0).Directions(i).Action = DirectionAction.ConstructionStop) Then
            Console.WriteLine("Construction ahead!")
    End If
    Console.WriteLine(myRoute.Itinerary.Segments(0).Directions(i).Instruction)
Next i

 
[C#]
//This example assumes that the service instance 
//'routeService' has already been created and that 
//the MapPoint Web Service namespace has been imported 

//Calculate a route and add a note for construction
LatLong[] latLongs = new LatLong[2];
latLongs[0] = new LatLong();
latLongs[0].Latitude = 40;
latLongs[0].Longitude = -120;
latLongs[1] = new LatLong();
latLongs[1].Latitude = 41;
latLongs[1].Longitude = -121;

Route myRoute;
myRoute = routeService.CalculateSimpleRoute(latLongs, "MapPoint.NA", SegmentPreference.Quickest);

for(int i = 0; i < myRoute.Itinerary.Segments[0].Directions.Length ; i++)
{
    if (myRoute.Itinerary.Segments[0].Directions[i].Action == DirectionAction.ConstructionDelay | 
        myRoute.Itinerary.Segments[0].Directions[i].Action == DirectionAction.ConstructionStop) 
    {
        Console.WriteLine("Construction ahead!");
    }
    Console.WriteLine(myRoute.Itinerary.Segments[0].Directions[i].Instruction);
}

 

See Also

Direction Class | DirectionAction Enumeration