Exemple #1
0
        /// <summary>
        /// 获取匹配结果
        /// </summary>
        protected void get_pipei_result()
        {
            //获取匹配的文章
            UsedPaper paperUsedClass = new UsedPaper();
            List <ScienceResearchDataSetNew.文章Row> paperList = paperUsedClass.provide_paper("text文件");

            //按照文章编号循环

            for (int i = 1; i <= paperList.Count; i++)
            {
                ScienceResearchDataSetNew.文章Row wz = paperList[i - 1];
                int    paperId   = wz.ID;
                string paperName = wz.文章名;
                if (paperName == "再别康桥")
                {
                    //int x = 1;
                }

                string paperPath = wz.text文件;
                paperPath = MainWindow.path_translate(paperPath);

                try
                {
                    StreamReader sr = new StreamReader(paperPath, Encoding.Default);
                    sr.Close();
                }
                catch
                {
                    MessageBox.Show("下列文件不存在:" + paperPath);
                    break;
                }

                string[] filelist = TextFile.GetStringArrayInPaper(paperPath);
                get_pipei_result_paper(filelist, wz);
            }
        }
Exemple #2
0
        /// <summary>
        /// 段文标签页
        /// </summary>
        /// <param name="yd"></param>
        public ReferTabItemUserControl(ScienceResearchDataSetNew.语段Row yd)
        {
            //用于显示语段内容

            InitializeComponent();
            saveToolBar.Visibility    = Visibility.Collapsed;
            partAllToolBar.Visibility = Visibility.Collapsed;

            scienceResearchKey        = MainWindow.scienceResearchKey;
            partRadioButton.IsChecked = true;

            richTextBox = textboxInkcavasUserControl.paragraphRichTextBox;
            yd_id       = yd.ID;
            LoadDataBase();
            textboxInkcavasUserControl.yd_id = yd_id;

            string yd_xaml = yd.语段;

            yd_xaml = TextFile.ReplaceLowOrderASCIICharacters(yd_xaml);
            //yd_xaml = yd_xaml.Replace(";", " ");
            string condition = yd_xaml.Substring(0, 13);

            if (condition == "<FlowDocument")
            {
                richTextBox.Document = xamlManageClass.xaml_load(yd_xaml);
            }
            else
            {
                FlowDocument doc = new FlowDocument();
                doc.LineHeight = 10;
                Paragraph p = new Paragraph();
                p.LineHeight = 30;
                Run r = new Run(yd.语段);
                //r.SetBinding(Run.TextProperty, binding);
                p.Inlines.Add(r);
                doc.Blocks.Add(p);
                richTextBox.Document = doc;
            }

            //加载墨笔
            path_isf = yd.语段isf;
            path_isf = MainWindow.path_translate(path_isf);
            if (path_isf != "")
            {
                FileStream file_ink = new FileStream(path_isf, FileMode.OpenOrCreate);
                if (file_ink.Length != 0)
                {
                    textboxInkcavasUserControl.inkCanvas.Strokes = new StrokeCollection(file_ink);
                }
                file_ink.Close();
            }
            if (path_isf == "")
            {
                //保存数据库
                yd.语段isf = @".\科学研究\语段ISF\" + yd.ID + ".isf";
                yd_ta.Update(yd_dt);
                path_isf = yd.语段isf;
                path_isf = MainWindow.path_translate(path_isf);
            }

            type = "yd";
            textboxInkcavasUserControl.type     = "yd";
            textboxInkcavasUserControl.path_isf = path_isf;

            //调整宽度
            double width = yd.宽度;

            if (width > 0)
            {
                textboxInkcavasUserControl.paragraphRichTextBox.Width = width;
                textboxInkcavasUserControl.inkCanvas.Width            = width;
            }
            else
            {
                textboxInkcavasUserControl.paragraphRichTextBox.Width = MainWindow.yd_ck_width;
                textboxInkcavasUserControl.inkCanvas.Width            = MainWindow.yd_ck_width;
            }

            zhinengPipeiUserControl.referTabItemUserControl          = this;
            zhinengPipeiUserControl.textboxInkcavasUserControl_using = textboxInkcavasUserControl;
            zhinengPipeiUserControl.type = "refer";
        }
Exemple #3
0
        /// <summary>
        /// 段文标签页
        /// </summary>
        /// <param name="wz"></param>
        public ReferTabItemUserControl(ScienceResearchDataSetNew.文章Row wz)
        {
            //用于显示文章内容

            InitializeComponent();
            //saveToolBar.Visibility = Visibility.Collapsed;
            partAllToolBar.Visibility = Visibility.Collapsed;

            scienceResearchKey        = MainWindow.scienceResearchKey;
            partRadioButton.IsChecked = true;
            type = "wz";
            textboxInkcavasUserControl.type = "wz";

            richTextBox = textboxInkcavasUserControl.paragraphRichTextBox;
            //FlowDocument flowDocument = new FlowDocument();
            //flowDocument.LineHeight = 50;
            //Paragraph paragraph = new Paragraph();
            //string title = "文章=" + wz.文章名;
            //Run run = new Run(title);
            //paragraph.Inlines.Add(run);
            //flowDocument.Blocks.Add(paragraph);
            //richTextBox.Document = flowDocument;

            textboxInkcavasUserControl.wz = wz;

            //---------------------读取文章------------------------------------------------
            path_wz = wz.text文件;
            path_wz = MainWindow.path_translate(path_wz);

            //判断文章是否存在
            try
            {
                StreamReader sr = new StreamReader(path_wz, Encoding.Default);
                sr.Close();
            }
            catch
            {
                MessageBox.Show("下列文件不存在:" + path_wz);
            }

            //读取文章
            string line_paper_str = TextFile.GetFileString(path_wz);

            //----------------------填充RichTextBox--------------------------------
            if (line_paper_str.Length >= 13 && line_paper_str.Substring(0, 13) == "<FlowDocument")
            {
                richTextBox.Document = xamlManageClass.xaml_load(line_paper_str);
            }
            else
            {
                FlowDocument doc = new FlowDocument();
                doc.LineHeight = 10;
                Paragraph p = new Paragraph();
                p.LineHeight = 30;
                Run r = new Run(line_paper_str);
                //r.SetBinding(Run.TextProperty, binding);
                p.Inlines.Add(r);
                doc.Blocks.Add(p);
                richTextBox.Document = doc;
            }

            textboxInkcavasUserControl.paragraphRichTextBox.Width = MainWindow.yd_ck_width;
            textboxInkcavasUserControl.inkCanvas.Width            = MainWindow.yd_ck_width;

            //--------------------加载墨笔--------------------------------------
            path_isf = path_wz.Substring(0, path_wz.Length - 3) + "isf";
            if (path_isf != "")
            {
                FileStream file_ink = new FileStream(path_isf, FileMode.OpenOrCreate);
                if (file_ink.Length != 0)
                {
                    textboxInkcavasUserControl.inkCanvas.Strokes = new StrokeCollection(file_ink);
                }
                file_ink.Close();
            }

            //----------------------设置智能匹配--------------------------------
            zhinengPipeiUserControl.referTabItemUserControl          = this;
            zhinengPipeiUserControl.textboxInkcavasUserControl_using = textboxInkcavasUserControl;
            zhinengPipeiUserControl.type = "refer";
        }