示例#1
0
文件: Form1.cs 项目: zhwcris/Mycoding
        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);
        }
示例#2
0
文件: Form1.cs 项目: v02zk/Mycoding
        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();
                }
            }

        }
示例#3
0
文件: Form1.cs 项目: v02zk/Mycoding
        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("请输入关键字");
            }
        }
示例#4
0
文件: Form1.cs 项目: v02zk/Mycoding
        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);
        }
示例#5
0
文件: Form1.cs 项目: zhwcris/Mycoding
        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();
                }
            }
        }
示例#6
0
文件: Form1.cs 项目: zhwcris/Mycoding
        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("请输入关键字");
            }
        }