I've configured a RoutingLayer like so:
RoutingLayer routingLayer = new RoutingLayer();
routingLayer.Name = "RoutingLayer";
LayerOverlay routingOverlay = new LayerOverlay();
routingOverlay.TileType = TileType.SingleTile;
routingOverlay.Name = "RoutingOverlay";
routingOverlay.Layers.Add(routingLayer.Name, routingLayer);
this.mapUI.Overlays.Add(routingOverlay.Name, routingOverlay);
Then, I generate a route, and add its path using this logic:
foreach (MultilineShape path in paths)
{
routingLayer.Routes.Add(path);
}
((LayerOverlay)this.mapUI.Overlays["RoutingOverlay"]).Refresh();
But when I call the Refresh method above I get a NullReferenceException. I just use the RoutingLayer to add the route path to its Routes collection.
What I want to do with that is refresh the overlay in order to show the route path on the map. If I remove this bold line, the route path shows when I interect with the map, without problems.