Ejemplo n.º 1
0
        private void anyOneDocHighLigth(string multiFilePath, ApplicationClass testWord, string keyWord, RichTextBox rtbHightLight,
                                        Label count, RichTextBox StatisticsInfor, HandleDocument handleDocument)
        {
            WaitingForm wf = new WaitingForm();

            HandleWaitingForm.startWaitingForm(wf);

            Document doc = handleDocument.openDocument(multiFilePath, testWord);

            highLightKeyWords(keyWord, testWord, doc, rtbHightLight, count, StatisticsInfor);
            closeDoc(doc);

            HandleWaitingForm.closeWaitingForm(wf);
        }
Ejemplo n.º 2
0
        private void keyTableItemList_SelectedIndexChanged(object sender, EventArgs e)
        {
            WaitingForm wf = new WaitingForm();

            HandleWaitingForm.startWaitingForm(wf);
            List <string> list = new List <string>();

            if (!testDocIsOpen)
            {
                testDocIsOpen = true;
                testDoc       = handleDocument.openDocument(testFileName, testWord);
            }
            list.Add((string)keyTableItemList.SelectedItem);
            KeyWord keyWord = new KeyWord();

            keyWord.highLightRichString(rbTableTest, testWord, testDoc, list);

            HandleWaitingForm.closeWaitingForm(wf);
        }
Ejemplo n.º 3
0
        private void btnFindTable_Click(object sender, EventArgs e)
        {
            tabControl2.SelectTab("tabCalculateTable");

            string regFileName = cbxRegDoc.Text;
            string tablename   = cbxTableList.Text;

            if (testFileName == null || testFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个目标文档");
            }
            else if (regFileName == null || regFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个规程文档");
            }
            else
            {
                if ((!regFileName.Equals(preRegFileName) || !testFileName.Equals(preTestFileName) ||
                     cbxTableListChanged == true))
                {
                    dataView.Rows.Clear();
                    rbTableTest.Clear();

                    WaitingForm wf = new WaitingForm();
                    HandleWaitingForm.startWaitingForm(wf);

                    string path = System.Environment.CurrentDirectory;
                    string name = regFileName;
                    name = path + "\\resources\\" + name + ".doc";

                    Document       regDoc         = new Document();
                    HandleDocument handleDocument = new HandleDocument();


                    if (!testDocIsOpen)
                    {
                        testDocIsOpen = true;
                        testDoc       = handleDocument.openDocument(testFileName, testWord);
                    }

                    regDoc = handleDocument.openDocument(name, testWord);
                    showItemInfo.Clear();
                    flagList.Clear();//清空标记合并单元格的标志
                    if (tablename != "")
                    {
                        calTables(1, regDoc, wf, tablename);
                    }
                    else
                    {
                        calTables(tableName.Length, regDoc, wf, "");
                    }
                    rbTableTest.Text = "请选择关键字";
                    KeyWord keyWord = new KeyWord();
                    //keyWord.highLightRichString(rbTableTest, testWord, testDoc, keyItemList);
                    rtbStandard.Text = keyWord.getStandardList();
                    generatekeyItemCombox();

                    Object saveChanges = false;
                    object unknow      = Type.Missing;

                    regDoc.Close(ref saveChanges, ref unknow, ref unknow);

                    HandleWaitingForm.closeWaitingForm(wf);

                    plTOC.Hide();
                    plKeyWord.Hide();
                    plMultiInfo.Hide();

                    plTableTest.Show();
                    showTableTreeView();
                    hideTOCTreeView();

                    cbxTableListChanged = false;
                    preRegFileName      = regFileName;
                    preTestFileName     = testFileName;

                    isMultiple = false;
                    tabControl2.Show();
                    tabControlMulti.Hide();
                }
            }
        }
Ejemplo n.º 4
0
        private void btnTestTable_Click(object sender, EventArgs e)
        {
            tabControl2.SelectTab("tabPageTest");

            string regFileName = cbxRegDoc.Text;

            if (testFileName == null || testFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个目标文档");
            }
            else if (regFileName == null || regFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个规程文档");
            }
            else if (!isTextMode())
            {
                MessageBox.Show("非文本文档检测模式不支持表格匹配,请在目录检测中选择文本模式");
            }
            else
            {
                HandleTable handleTable = new HandleTable(testWord);

                string path = System.Environment.CurrentDirectory;
                string name = regFileName;
                name = path + "\\resources\\" + name + ".doc";

                Document       regDoc         = new Document();
                HandleDocument handleDocument = new HandleDocument();

                WaitingForm wf = new WaitingForm();
                HandleWaitingForm.startWaitingForm(wf);

                if (!testDocIsOpen)
                {
                    testDocIsOpen = true;
                    testDoc       = handleDocument.openDocument(testFileName, testWord);
                }

                regDoc = handleDocument.openDocument(name, testWord);

                handleTable.contrastTablesOfDocs(regDoc, testDoc, showItemInfo, tvRegTable
                                                 , tvTestTable, null, null, null);

                Object saveChanges = false;
                object unknow      = Type.Missing;

                regDoc.Close(ref saveChanges, ref unknow, ref unknow);

                HandleWaitingForm.closeWaitingForm(wf);

                plTOC.Hide();
                plKeyWord.Hide();
                plMultiInfo.Hide();

                plTableTest.Show();
                showTableTreeView();
                hideTOCTreeView();

                isMultiple = false;
                tabCalculateTable.Show();
                tabControlMulti.Hide();
            }
        }
Ejemplo n.º 5
0
        private Boolean ifExecuted = false;//判断单文档关键字查询是否执行了

        private void btnFindKeyWord_Click(object sender, EventArgs e)
        {
            string keyword = cbxKeyWord.Text;

            if (keyword.Trim() != "")
            {
                KeyWordCache.putKeyWordInCache(keyword, KeyWordCache.KEYWORD);
                KeyWordCache.update(cbxKeyWord, KeyWordCache.KEYWORD);

                tabControl2.SelectTab("tabPageFind");

                if (checkKeyWordInput(testFileName, multiTestFilePath, multiRegFilePath, multiSpecFilePath) == true)//检查输入不为空
                {
                    KeyWord keyWord = new KeyWord();
                    if (!isMultiple)//danwendang
                    {
                        if (testDoc != null)
                        {
                            if (!testFileName.Equals(preTestFileName) || keywordChanged)//如果路径改变或者关键字改变则认为关键字查询没有执行
                            {
                                ifExecuted = false;
                            }
                            if (!testFileName.Equals(preTestFileName) || keywordChanged || !ifExecuted)
                            {
                                WaitingForm wf = new WaitingForm();
                                HandleWaitingForm.startWaitingForm(wf);
                                if (!testDocIsOpen)
                                {
                                    testDocIsOpen = true;
                                    testDoc       = handleDocument.openDocument(testFileName, testWord);
                                }

                                keyWord.highLightKeyWords(cbxKeyWord.Text, testWord, testDoc, richTxbTestDoc, lbCountItems, rtbKeyWord);

                                HandleWaitingForm.closeWaitingForm(wf);
                                ifExecuted = true;

                                preTestFileName = testFileName;

                                /////查询关键字对应的标准规范值
                                string value = keyWord.getExistStandard(keyword);
                                lbKeyWordSingle.Text = keyword;
                                if (value != null)
                                {
                                    lbKeyWordValueSingle.Text = value;
                                }
                                else
                                {
                                    lbKeyWordValueSingle.Text = "";
                                }
                            }
                        }
                    }
                    else
                    {
                        keyWord.multiHightLigthKeyWord(preMultiTestFilePath, preMultiRegFilePath, preMultiSpecFilePath, multiTestFilePath, multiRegFilePath, multiSpecFilePath, keyword, testWord, rtbTestDoc, rtbRegDoc,
                                                       rtbSpecificationDoc, null, null, null, rtxMultiTestDoc, rtbMultiRegDoc, rtbMultiSpecDoc, handleDocument, keywordChanged);
                        updatePreFilePath();

                        /////查询关键字对应的标准规范值
                        string value = keyWord.getExistStandard(keyword);
                        lbKeyWord.Text = keyword;
                        if (value != null)
                        {
                            lbKeyWordValue.Text = value;
                        }
                        else
                        {
                            lbKeyWordValue.Text = "无标准数值信息";
                        }
                    }
                }

                plTableTest.Hide();
                plTOC.Hide();
                if (!isMultiple)
                {
                    plMultiInfo.Hide();
                    plKeyWord.Show();
                }
                else
                {
                    plKeyWord.Hide();
                    plMultiInfo.Show();
                }
                keywordChanged = false;
            }
            else
            {
                MessageBox.Show("请输入关键字");
            }
        }
Ejemplo n.º 6
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            string regFileName = cbxRegDoc.Text;

            if (testFileName == null || testFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个目标文档");
            }
            else if (regFileName == null || regFileName.Trim() == "")
            {
                MessageBox.Show("请选择一个规程文档");
            }
            else
            {
                ////改为察看系统中所有规程,现在为察看是否在列表中。当前列表显示所有规程,以后改为显示前n项
                if (cbxRegDoc.Items.Contains(regFileName))
                {
                    if (isTextMode())
                    {
                        WaitingForm wf = new WaitingForm();
                        HandleWaitingForm.startWaitingForm(wf);
                        if (!testDocIsOpen)
                        {
                            testDocIsOpen = true;
                            testDoc       = handleDocument.openDocument(testFileName, testWord);
                        }

                        //////获得规程文档目录内容
                        //////如果规程文档与上次相同则不重新载入
                        //if (preRegFileName != regFileName)
                        //{
                        if (regDocSForm != null && regDocSForm.isAddNewRegDoc())
                        {
                            regTOCContents = regDocSForm.getRegTOCContents();
                        }
                        else
                        {
                            regTOCContents = tableOfContents.getTOCContentsByName(regFileName);
                        }
                        writeRegToListBox(regTOCContents, regTreeView);
                        // }


                        //////获得测试文档目录内容
                        //////如果测试文档与上次相同则不重新载入
                        if ((preTestFileName != testFileName) || !tocTestStarted)
                        {
                            testTOCContents = handleDocument.getTestTextDocTOC(testDoc, testWord);
                        }

                        Dictionary <string, List <string> > msgContentList = new Dictionary <string, List <string> >();
                        msgContentList.Add("error", new List <string>());
                        msgContentList.Add("spare", new List <string>());
                        msgContentList.Add("missing", new List <string>());

                        writeTocTOListBox(testTOCContents, testTreeView, regTreeView, msgContentList);

                        tableOfContents.update(cbxRegDoc);
                        tabControl2.SelectTab("tabPageTest");

                        ////记录本次操作的规程文档和测试文档文件名
                        preRegFileName  = regFileName;
                        preTestFileName = testFileName;
                        HandleWaitingForm.closeWaitingForm(wf);

                        ////显示错误报告项目
                        List <string> list = msgContentList["error"];
                        int           c    = list.Count;
                        //MessageBox.Show(c.ToString());
                        list = msgContentList["spare"];
                        c    = list.Count;
                        //MessageBox.Show(c.ToString());
                        list = msgContentList["missing"];
                        c    = list.Count;
                        // MessageBox.Show(c.ToString());



                        if (!reportMSG.Contains(textTOCMSG))
                        {
                            reportMSG += textTOCMSG;
                        }
                    }
                    else if (isSpecificationMode())
                    {
                        WaitingForm wf = new WaitingForm();
                        HandleWaitingForm.startWaitingForm(wf);

                        if (!testDocIsOpen)
                        {
                            testDocIsOpen = true;
                            testDoc       = handleDocument.openDocument(testFileName, testWord);
                        }

                        //////获得规程文档目录内容
                        //////如果规程文档与上次相同则不重新载入
                        if (preRegFileName != regFileName)
                        {
                            Dictionary <string, List <string> > specificationDict = null;
                            if (regDocSForm != null && regDocSForm.isAddNewRegDoc())
                            {
                                specificationDict = regDocSForm.getSpecificationTOCContents();
                            }
                            else
                            {
                                specificationDict = tableOfContents.getSpecificationTOCContentsByName(regFileName);
                            }
                            writeRegSpecipicationToListBox(specificationDict, regTreeView);
                        }


                        //////获得测试文档目录内容
                        //////如果测试文档与上次相同则不重新载入
                        if (preTestFileName != testFileName)
                        {
                            testTOCContents = handleDocument.getTestSpecificationDocTOC(testDoc, testWord);
                            writeSpecificationTocTOListBox(testTOCContents, testTreeView, regTreeView);
                        }
                        tableOfContents.update(cbxRegDoc);
                        tabControl2.SelectTab("tabPageTest");

                        ////记录本次操作的规程文档和测试文档文件名
                        preRegFileName  = regFileName;
                        preTestFileName = testFileName;

                        HandleWaitingForm.closeWaitingForm(wf);

                        if (!reportMSG.Contains(specifiTOCMSG))
                        {
                            reportMSG += specifiTOCMSG;
                        }
                    }
                    else
                    {
                        MessageBox.Show("请选择一种比较方法");
                    }

                    plKeyWord.Hide();
                    plTableTest.Hide();

                    hideTableTreeView();
                    hideTableTreeView();
                    tabControlMulti.Hide();

                    tabControl2.Show();
                    showTOCTreeView();
                    plTOC.Show();

                    if (testDocIsOpen)
                    {
                        closeTestDoc();
                    }
                }
                else
                {
                    MessageBox.Show("选择的规程文档不存在");
                }
                //closeTestDoc();
            }
        }
Ejemplo n.º 7
0
        private void btnAddNewDoc_Click(object sender, EventArgs e)
        {
            if (rbText.Checked || rbSpecification.Checked)
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Filter = "Word文件|*.doc";
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    regFileName = openFileDialog.FileName;
                    string filename = regFileName.Substring(regFileName.LastIndexOf("\\") + 1, regFileName.LastIndexOf(".") - regFileName.LastIndexOf("\\") - 1);
                    if (rbText.Checked)
                    {
                        if (!textResults.Contains(filename))
                        {
                            waitForm = new WaitingForm();
                            HandleWaitingForm.startWaitingForm(waitForm);

                            regTOCContents = toc.AddRegToSysResource(regFileName);
                            addNewRegDoc   = true;
                            textResults.Add(filename);
                            txbDocName.Text = filename;
                            tvRegDoc.Nodes.Add(filename);
                            tvRegDoc.Update();

                            HandleWaitingForm.closeWaitingForm(waitForm);
                        }
                        else
                        {
                            if (MessageBox.Show("已存在!是否替换", "提示框", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                waitForm = new WaitingForm();
                                HandleWaitingForm.startWaitingForm(waitForm);

                                regTOCContents  = toc.AddRegToSysResource(regFileName);
                                addNewRegDoc    = true;
                                txbDocName.Text = filename;

                                HandleWaitingForm.closeWaitingForm(waitForm);
                            }
                            else
                            {
                                //
                            }
                        }
                    }
                    else
                    {
                        if (!specificationResults.Contains(filename))
                        {
                            waitForm = new WaitingForm();
                            HandleWaitingForm.startWaitingForm(waitForm);

                            HandleDocument handleDocument = new HandleDocument();
                            ////获得说明书规程文档目录
                            ////将说明书目录存入系统
                            specificationTOCContents = toc.AddSpecificationToSysResource(regFileName);

                            addNewRegDoc = true;
                            specificationResults.Add(filename);
                            txbDocName.Text = filename;
                            tvSpecificationDoc.Nodes.Add(filename);
                            tvSpecificationDoc.Update();

                            HandleWaitingForm.closeWaitingForm(waitForm);
                        }
                        else
                        {
                            if (MessageBox.Show("已存在!是否替换", "提示框", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                waitForm = new WaitingForm();
                                HandleWaitingForm.startWaitingForm(waitForm);

                                HandleDocument handleDocument = new HandleDocument();
                                ////获得说明书规程文档目录
                                ////将说明书目录存入系统
                                specificationTOCContents = toc.AddSpecificationToSysResource(regFileName);
                                addNewRegDoc             = true;
                                txbDocName.Text          = filename;

                                HandleWaitingForm.closeWaitingForm(waitForm);
                            }
                            else
                            {
                                //
                            }
                        }
                    }
                    toc.update(cbx);
                }
            }
            else
            {
                MessageBox.Show("请选择一种规程类型");
            }
        }