private void ArbaroMainForm_Shown(object sender, EventArgs e)
        {
            csParams.OnParamChanged += csParams_OnParamChanged;

            pgv = new CS_ParamGroupsView(treeView1);
            pvt = new CS_ParamValueTable(paramTablePanel, paramExplanationPanel, csParams);
            pev = new CS_ParamExplanationView(paramExplanationPanel, paramTablePanel, csParams);

            treeView1.AfterSelect += treeView1_AfterSelect;
        }
        private void MakeTreeFromParams(string filename, bool paramExists = false)
        {
            if (!paramExists)
            {
                csParams = new CS_Params();
                csParams.prepare(13);

                ResetMenuItems();

                if (filename != "")
                {
                    Text = "Arbaro C# V0.1 - " + Path.GetFileName(mainOpenFileDialog.FileName);
                    csParams.readFromXML(mainOpenFileDialog.FileName);
                }
                else
                {
                    Text = "Arbaro C# V0.1";
                }

                // refresh params GUI
                pgv = new CS_ParamGroupsView(treeView1);
                pvt = new CS_ParamValueTable(paramTablePanel, paramExplanationPanel, csParams);
                pev = new CS_ParamExplanationView(paramExplanationPanel, paramTablePanel, csParams);

                csParams.enableDisable();
                csParams.OnParamChanged += csParams_OnParamChanged;
            }

            CS_PreciseTimer  t0            = new CS_PreciseTimer(10);
            DateTime         tStart        = t0.Now;
            CS_TreeGenerator treeGenerator = CS_TreeGeneratorFactory.createShieldedTreeGenerator(csParams);

            tree = treeGenerator.makeTree(new Object());
            DateTime tEnd = t0.Now;


            // make 3D Tree
            if (Program.Renderer.RenderableList.ContainsKey("Skeleton"))
            {
                DXRenderable s = Program.Renderer.RenderableList["Skeleton"];
                Program.Renderer.RenderableList.Remove("Skeleton");
                s.Dispose();
            }
            DXTreeSkeleton sk = new DXTreeSkeleton(tree, csParams);

            sk.Visible = false;
            Program.Renderer.RenderableList.Add("Skeleton", sk);
            if (skeletonToolStripMenuItem.Checked)
            {
                sk.Visible = true;
            }
            else
            {
                sk.Visible = false;
            }

            if (Program.Renderer.RenderableList.ContainsKey("TreeMesh"))
            {
                DXRenderable s = Program.Renderer.RenderableList["TreeMesh"];
                Program.Renderer.RenderableList.Remove("TreeMesh");
                s.Dispose();
            }

            //DXTreeMesh me = new DXTreeMesh(tree, csParams);
            //Program.Renderer.RenderableList.Add("TreeMesh", me);
            DXArbaroTreeMesh me = new DXArbaroTreeMesh(tree, csParams);

            Program.Renderer.RenderableList.Add("TreeMesh", me);

            if (solidWireframeToolStripMenuItem.Checked)
            {
                me.Visible = true;
            }
            else
            {
                me.Visible = false;
            }

            // only reset the view when a new tree is loaded
            if (!paramExists)
            {
                Program.Renderer.CameraControler.LookAt(me.BBox);
            }

            float elapsed = (float)(tEnd.Subtract(tStart)).TotalMilliseconds;

            Console.WriteLine(elapsed);
        }