Пример #1
0
        /// <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);
                    }
                }
            }
        }
Пример #2
0
        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;
            }
        }