private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.currentFile != null)
            {
                if (this.currentFile.treeHandler.Tree.IsTemplate == false)
                {
                    this.saveFileDialog1.FileName = this.currentFile.tabPage.Name + ".tree";
                    this.saveFileDialog1.Filter   = "Tree File|*.tree";
                    if (this.currentFile.savePath != null)
                    {
                        this.saveFileDialog1.InitialDirectory = this.currentFile.savePath;
                    }

                    if (this.saveFileDialog1.ShowDialog() == DialogResult.OK)
                    {
                        if (this.saveFileDialog1.FileName.Trim().Length > 0)
                        {
                            this.currentFile.SaveTree(this.saveFileDialog1.FileName);
                            this.currentFile.state = PageState.Save;
                        }
                    }
                }
                else
                {
                    TemplateHandler.getInstance().setBaseTrees(this.baseTrees);
                    this.currentFile.state = PageState.Save;
                }
            }
        }
        /// <summary>
        /// 退出
        /// </summary>
        private void quit()
        {
            NodeHandler.getInstance().setBaseNodes(this.baseNodes);
            PreconditionHandler.getInstance().setBasePreconditions(this.basePreconditions);
            TemplateHandler.getInstance().setBaseTrees(this.baseTrees);
            if (this.currentFile != null && this.currentFile.savePath != null && this.currentFile.isTemplate == false)
            {
                PageHandler.getInstance().setLastPage(this.currentFile.savePath);
            }

            if (this.openFiles != null && this.openFiles.Count > 0)
            {
                foreach (var item in this.openFiles)
                {
                    if (item.savePath != null && item.savePath.Length > 0)
                    {
                        item.SaveTree(item.savePath);
                    }
                }
            }
        }
        private void MainForm_Load(object sender, EventArgs e)
        {
            //初始化数据
            this.openFiles         = new List <Page>();
            this.basePreconditions = PreconditionHandler.getInstance().getBasePreconditions();
            if (this.basePreconditions == null)
            {
                this.basePreconditions = new List <Precondition>();
            }
            this.baseNodes = NodeHandler.getInstance().getBaseNodes();
            if (this.baseNodes == null)
            {
                this.baseNodes = new List <Node>();
            }
            this.baseTrees = TemplateHandler.getInstance().getBaseTrees();
            if (this.baseTrees == null)
            {
                this.baseTrees = new List <Tree>();
            }

            //数据源绑定
            this.NodeListBoxDataBinding();
            this.PreconditionListBoxDataBinding();
            this.TemplateListBoxDataBinding();

            //显示
            this.toolStripStatusLabel1.Text = "版本: 1.0.1.0";

            //加载最后修改文件
            string path = PageHandler.getInstance().getLastPage();

            if (path != null && path.Length > 0 && File.FileIsExist(path))
            {
                Page page = new Page(path);
                this.tabControl2.TabPages.Add(page.tabPage);
                this.tabControl2.SelectedTab = page.tabPage;
                this.openFiles.Add(page);
                this.currentFile = page;
            }
        }