Exemple #1
0
        private void treeProject_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            switch (e.Node.ImageKey)
            {
            case "script":
            case "page":
            case "text":
                TabPage blank = FindTabByTag(e.Node.FullPath, true);

                string path = project.PathFromNode(e.Node);
                string data = (File.Exists(path)) ? File.ReadAllText(path) : "";

                if (blank != null)
                {
                    // not found, is there a blank new one?
                    SyntaxBoxControl syn = blank.Controls[0] as SyntaxBoxControl;

                    if (syn != null)
                    {
                        blank.Text        = e.Node.Text;
                        blank.Tag         = e.Node.FullPath;
                        syn.Document.Text = data;
                    }
                }
                else                         // new tab
                {
                    AddTabLUA(e.Node.Text, e.Node.FullPath, data);
                }
                break;

            case "sound":
            case "music":
                // system default
                try
                {
                    System.Diagnostics.Process.Start(project.PathFromNode(e.Node));
                }
                catch (Exception ex) {
                    // no default handler
                }
                break;

            case "image":
                // internal image viewer?
                if (FindTabByTag(e.Node.FullPath, false) == null)
                {
                    AddTabImage(e.Node.Text, e.Node.FullPath, project.PathFromNode(e.Node));
                }
                break;

            case "package":
            case "config":
                mnupopProperties_Click(null, null);
                break;

            default:
                break;
            }
            UpdateButtons();
        }