private void mnu_addSourceProject(object sender, EventArgs e)
        {
            TreeViewWix tv = this.TreeView as TreeViewWix;
            Form        f  = null;

            if (this.TreeView != null)
            {
                f = this.TreeView.FindForm();
            }
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "Limnor Project|*.lrproj";
            dlg.Title  = "Select Limnor Project File";
            if (dlg.ShowDialog(f) == DialogResult.OK)
            {
                Folder.AddProject(dlg.FileName);
                if (tv != null)
                {
                    tv.OnPropertyValueChanged();
                }
                UserControlSetupProperties ucp = getHolder();
                if (ucp != null)
                {
                    ucp.OnSelectTreeNode(this);
                }
            }
        }
        private void mnu_addFolder(object sender, EventArgs e)
        {
            TreeViewWix tv = this.TreeView as TreeViewWix;
            Form        f  = null;

            if (this.TreeView != null)
            {
                f = this.TreeView.FindForm();
            }
            DlgFolderName dlg = new DlgFolderName();

            dlg.LoadData(Folder.Folders);
            if (dlg.ShowDialog(f) == DialogResult.OK)
            {
                this.Expand();
                WixFolderNode     fo = Folder.AddFolder(dlg.NewName);
                TreeNodeWixFolder tn = new TreeNodeWixFolder(fo);
                tn.SelectFile += new EventHandler(tn_SelectFile);
                Nodes.Add(tn);
                if (this.TreeView != null)
                {
                    this.TreeView.SelectedNode = tn;
                }
                if (tv != null)
                {
                    tv.OnPropertyValueChanged();
                    UserControlSetupProperties ucp = getHolder();
                    if (ucp != null)
                    {
                        ucp.OnSelectTreeNode(tn);
                    }
                }
            }
        }
        private UserControlSetupProperties getHolder()
        {
            Control c = this.TreeView;

            while (c != null)
            {
                UserControlSetupProperties u = c as UserControlSetupProperties;
                if (u != null)
                {
                    return(u);
                }
                c = c.Parent;
            }
            return(null);
        }
        public void mnu_addFiles(object sender, EventArgs e)
        {
            TreeViewWix tv = this.TreeView as TreeViewWix;
            Form        f  = null;

            if (this.TreeView != null)
            {
                f = this.TreeView.FindForm();
            }
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Multiselect = true;
            if (dlg.ShowDialog(f) == DialogResult.OK)
            {
                string[] ss = dlg.FileNames;
                if (ss != null && ss.Length > 0)
                {
                    bool          b   = false;
                    WixFolderNode app = Folder;
                    for (int i = 0; i < ss.Length; i++)
                    {
                        WixSourceFileNode existFile = app.GetWixNodeByName(ss[i]);
                        if (existFile == null)
                        {
                            existFile = app.AddFile(ss[i]);
                            b         = true;
                        }
                        if (SelectFile != null)
                        {
                            SelectFile(existFile, EventArgs.Empty);
                        }
                    }
                    if (b && tv != null)
                    {
                        tv.OnPropertyValueChanged();
                        UserControlSetupProperties ucp = getHolder();
                        if (ucp != null)
                        {
                            ucp.OnSelectTreeNode(this);
                        }
                    }
                }
            }
        }
        public void mnu_addSourceFolder(object sender, EventArgs e)
        {
            TreeViewWix tv = this.TreeView as TreeViewWix;
            Form        f  = null;

            if (this.TreeView != null)
            {
                f = this.TreeView.FindForm();
            }
            FolderBrowserDialog dlg = new FolderBrowserDialog();

            dlg.Description = "All files in the selected folder will be included in the setup";
            if (dlg.ShowDialog(f) == DialogResult.OK)
            {
                bool b = true;
                WixSourceFileNode fn = Folder.GetWixNodeByName(dlg.SelectedPath);
                if (fn != null)
                {
                    MessageBox.Show(f, "Source folder is already included", "Add Source Folder", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    b = false;
                }
                else
                {
                    fn = Folder.AddFile(dlg.SelectedPath);
                }
                if (SelectFile != null)
                {
                    SelectFile(fn, EventArgs.Empty);
                }
                if (b && tv != null)
                {
                    tv.OnPropertyValueChanged();
                    UserControlSetupProperties ucp = getHolder();
                    if (ucp != null)
                    {
                        ucp.OnSelectTreeNode(this);
                    }
                }
            }
        }