public void UpdateObjectTree()
{
MainWindow.mainWindow.ObjectTree.Children.Clear();
foreach (GameObject obj in objectManager.GetObjects())
{
MapGameObject mapObject = obj as MapGameObject;
if (mapObject != null)
{
CheckBoxPair checkPair = new CheckBoxPair();
string name = "";
foreach (KeyValuePair <string, GameObjectProperty> property in mapObject.Properties)
{
if (property.Key == "Name")
{
name = property.Value.CurrentValue;
}
}
checkPair.MainLabel.Text = name;
checkPair.MainCheckBox.IsChecked = mapObject.Visible;
checkPair.MainCheckBox.Click += (sender, e) =>
{
mapObject.Visible = (bool)checkPair.MainCheckBox.IsChecked;
};
MainWindow.mainWindow.ObjectTree.Children.Add(checkPair);
}
}
}