//event handler for calculate path button void btnFinalTree_Click(object sender, RoutedEventArgs e) { if (floorBacklog == null || floorBacklog.Edges == null || floorBacklog.Source == null) { return; } //call bellmanFord Function with the list of all edges and initial point BellmanFord.MakeBellmanFordTree(floorBacklog.Edges, floorBacklog.Source); Tile vertex = floorBacklog.Destination; //start from destination and until source is not reached color all the vertices in the way orange (using converting tile into destination as shortcut to painting orange, as destination tiles already have a style, containing orange foreground while (vertex.Parent != null) { vertex.Type = ShapeType.Destination; vertex = vertex.Parent; } }