// Add layer button clicked private void addLayerButton_Click(object sender, EventArgs e) { Debug.Assert(layersTreeView.SelectedNode is LayerNode); SelectMaterialLayerType newLayerForm = new SelectMaterialLayerType(); if (newLayerForm.ShowDialog() == DialogResult.OK) { LayerNode node = layersTreeView.SelectedNode as LayerNode; MaterialLayer newLayer = EditorMaterialLayer.create(newLayerForm.getSelectedType()); addNewLayer(newLayer); } }