Exemplo n.º 1
0
        /// <summary>
        /// 检查事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCheck_Click(object sender, EventArgs e)
        {
            //检查文件路径
            if (cbJGFHX.Checked)
            {
                CheckPath checkPath = new CheckPath();
                checkPath.CheckPathMsg(tbBrowse.Text, this);
            }
            //成果文件配置
            if (cbJGFHX.Checked)
            {
                CheckFile checkFile = new CheckFile();
                checkFile.CheckFileMsg(checkFile.ReturnFiles(tbBrowse.Text, this), tbBrowse.Text, this);
            }
            if (cbJCZB.Checked)
            {
                CheckFile    checkFile = new CheckFile();
                CheckZhiBiao zhibiao   = new CheckZhiBiao();
                //zhibiao.CheckZhiBiaoMsg(ComMsg.infoList, tbBrowse.Text, this);
                Thread thread = new Thread(delegate() { zhibiao.CheckZhiBiaoMsg(ComMsg.infoList, tbBrowse.Text, this); });
                thread.Start();
            }
            if (cbJCZB.Checked)
            {
                CheckGuiZe guize = new CheckGuiZe();
                guize.CheckSempleGuiZe(tbBrowse.Text, this);
            }
            /********************此区域预留用于检查其它项目,代码参考CheckPathMsg**************************/

            /********************************************************************************************/
            //将错误信息写入首页的DataGridView
            WriteFile writeFile = new WriteFile();

            this.rtbLog.Text += "\n " + DateTime.Now.ToLongTimeString() + "写入列表文件";
            writeFile.WriteDataGridView(ComMsg.ResultShow, this.dgCheckResult);

            //生成文档
            CreateFile createFile = new CreateFile();

            createFile.CreateDoc(tbBrowse.Text, cmbType.Text); //创建word文档
            createFile.CreateXls(tbBrowse.Text, cmbType.Text); //创建Excel文档

            //写入文档
            this.rtbLog.Text += "\n " + DateTime.Now.ToLongTimeString() + "写入Excel文件";
            writeFile.WriteXls(ComMsg.xlsPath);      //向Excel文档中写入检查结果
            this.rtbLog.Text += "\n " + DateTime.Now.ToLongTimeString() + "写入Word文件";
            createFile.WrithDocFile(ComMsg.docPath); //向doc文档中写入检查结果


            //清空相关的文档
            ComMsg.docPath    = string.Empty;
            ComMsg.xlsPath    = string.Empty;
            ComMsg.infoList   = new List <FileInfo>();
            ComMsg.ResultShow = new List <ResultEntity>();
        }