Things are going good now.
Structuring the app this way lends itself nicely with aTreeView/PropertyGrid GUI scheme. I just want to show how it is coming together and how the GUI chores can go away when doing it this way.
Friend Sub InitializeTreeView()
Tree.ImageList = ImageList1
Tree.BeginUpdate()
Tree.Nodes.Clear()
With ImageList1.Images
.Add(New Drawing.Bitmap(My.Resources.help_book.ToBitmap)) '0
.Add(New Drawing.Bitmap(My.Resources.help_obook.ToBitmap)) '1
.Add(New Drawing.Bitmap(My.Resources.ball_glass_blueS.ToBitmap)) '2
.Add(New Drawing.Bitmap(My.Resources.ball_glass_greenS.ToBitmap)) '3
.Add(New Drawing.Bitmap(My.Resources.ball_glass_redS.ToBitmap)) '4
.Add(New Drawing.Bitmap(My.Resources.ball_glass_yellowS.ToBitmap)) '5
.Add(New Drawing.Bitmap(My.Resources.square_blueS.ToBitmap)) '6
.Add(New Drawing.Bitmap(My.Resources.square_greenS.ToBitmap)) '7
.Add(New Drawing.Bitmap(My.Resources.square_redS.ToBitmap)) '8
.Add(New Drawing.Bitmap(My.Resources.square_yellowS.ToBitmap)) '9
.Add(New Drawing.Bitmap(My.Resources.triangle_blueS.ToBitmap)) '10
.Add(New Drawing.Bitmap(My.Resources.triangle_greenS.ToBitmap)) '11
.Add(New Drawing.Bitmap(My.Resources.triangle_redS.ToBitmap)) '12
.Add(New Drawing.Bitmap(My.Resources.triangle_yellowS.ToBitmap)) '13
End With
For Each Project As _Project In Projects
Tree.Nodes.Add(Project.Name, Project.Name, 0, 1)
For Each Building As _Building In Buildings
If Building.Project.Index = Project.Index Then
Tree.Nodes(Project.Name).Nodes.Add(Building.Name, Building.Name, 2, 2)
End If
For Each Storey As _Storey In Storeys
If Storey.Building.Index = Building.Index Then
Tree.Nodes(Project.Name).Nodes(Building.Name).Nodes.Add(Storey.Name, Storey.Name, 3, 3)
End If
For Each Wall As _Wall In Walls
If Wall.Storey.Index = Storey.Index Then
Tree.Nodes(Project.Name).Nodes(Building.Name).Nodes(Storey.Name).Nodes.Add(Wall.Name, Wall.Name, 4, 4)
For Each Window As _Window In Windows
If Window.Wall.Index = Wall.Index Then
Tree.Nodes(Project.Name).Nodes(Building.Name).Nodes(Storey.Name).Nodes(Wall.Name).Nodes.Add(Window.Name, Window.Name, 10, 10)
End If
Next
For Each Door As _Door In Doors
If Door.Wall.Index = Wall.Index Then
Tree.Nodes(Project.Name).Nodes(Building.Name).Nodes(Storey.Name).Nodes(Wall.Name).Nodes.Add(Door.Name, Door.Name, 11, 11)
End If
Next
For Each BeamPocket As _BeamPocket In BeamPockets
If BeamPocket.Wall.Index = Wall.Index Then
Tree.Nodes(Project.Name).Nodes(Building.Name).Nodes(Storey.Name).Nodes(Wall.Name).Nodes.Add(BeamPocket.Name, BeamPocket.Name, 12, 12)
End If
Next
For Each Partition As _Partition In Partitions
If Partition.Wall.Index = Wall.Index Then
Tree.Nodes(Project.Name).Nodes(Building.Name).Nodes(Storey.Name).Nodes(Wall.Name).Nodes.Add(Partition.Name, Partition.Name, 13, 13)
End If
Next
End If
Next
Next
Next
Next
Tree.EndUpdate()
End Sub