private void treeView1_DoubleClick(object sender, EventArgs e) { Type selectedNodeType; if (treeView1.SelectedNode != null) { selectedNodeType = treeView1.SelectedNode.Tag.GetType(); if (selectedNodeType.Name == ShaderValueName) { Shader shader = (Shader)treeView1.SelectedNode.Tag; AddShaderForm f = new AddShaderForm(shader, _filePath); DialogResult dr = f.ShowDialog(); if (dr == DialogResult.OK) { treeView1.Nodes.Clear(); resourcesData.AttachToTree(treeView1); } } else if (selectedNodeType.Name == TexturePackValueName) { TexturePack texturePack = (TexturePack)treeView1.SelectedNode.Tag; AddTexturePackForm f = new AddTexturePackForm(texturePack, _filePath); DialogResult dr = f.ShowDialog(); if (dr == DialogResult.OK) { treeView1.Nodes.Clear(); resourcesData.AttachToTree(treeView1); } } else if (selectedNodeType.Name == ModelValueName) { Model model = (Model)treeView1.SelectedNode.Tag; AddModelForm f = new AddModelForm(model, _filePath); DialogResult dr = f.ShowDialog(); if (dr == DialogResult.OK) { treeView1.Nodes.Clear(); resourcesData.AttachToTree(treeView1); } } } // treeView1.Refresh(); }
private void addModelToolStripMenuItem_Click(object sender, EventArgs e) { Container parentContainer = (Container)treeView1.SelectedNode.Tag; Model model = parentContainer.CreateModel(); AddModelForm f = new AddModelForm(model, _filePath); DialogResult dr = f.ShowDialog(); if (dr == DialogResult.OK) { parentContainer.AddModel(model); //TreeNode newTreeNode = new TreeNode(); // shader.AttachToTreeNode(treeView1.SelectedNode.Nodes, newTreeNode); resourcesData.ReAttachToTree(treeView1); } }