private void Compelet()
        {
            Regex re = new Regex(@"\\bibliography\{(\w+)\}");

            Match  m    = re.Match(this.textEditor.Document.Text);
            string path = @"Z:\30\1\ref.bib";// m.Groups[1].Captures[0].ToString() + " .bib";

            //if (e.Text == @"\ref{")
            {
                // open code completion after the user has pressed dot:
                completionWindow = new CompletionWindow(textEditor.TextArea);
                // provide AvalonEdit with the data:
                IList <ICompletionData> data  = completionWindow.CompletionList.CompletionData;
                StringBuilder           entry = new StringBuilder();

                foreach (BibTex b in BibTex.Parse(path))
                {
                    MyCompletionData d = new MyCompletionData(b.UID);
                    //d.Name = "name";
                    //d.Description = "des";
                    //d.Content = "content";
                    data.Add(d);
                }
                completionWindow.Show();
                completionWindow.Closed += delegate
                {
                    completionWindow = null;
                };
            }
        }
예제 #2
0
        private void populate(string s = "")
        {
            Regex reBiblio = new Regex(@"(?<!%)(?<=\\bibliography\{)([^\{]+)(?=\})", RegexOptions.IgnoreCase);
            Match m        = reBiblio.Match(Textdoc.txtEditor.Text);

            if (m.Success)
            {
                this.path = this.Textdoc.CurrentFileInfo.Directory + "\\" + m.Groups[1].Captures[0].Value.ToString() + ".bib";
            }

            this.listView1.Items.Clear();
            foreach (BibTex entry in BibTex.Parse(this.path))
            {
                if (entry.Text.Contains(s) || string.IsNullOrEmpty(s))
                {
                    ListViewItem item = new ListViewItem(new string[] { "", "", entry.UID, entry["author"], entry["title"], entry["journal"], entry.Text });
                    item.ToolTipText = entry.Text;
                    item.Tag         = entry.UID;
                    this.listView1.Items.Add(item);
                }
            }
        }
예제 #3
0
        private void Compelet()
        {
            string path     = "";
            Regex  reBiblio = new Regex(@"(?<!%)(?<=\\bibliography\{)([^\{]+)(?=\})", RegexOptions.IgnoreCase);
            Match  m        = reBiblio.Match(txtEditor.Text);

            if (m.Success)
            {
                path = this.CurrentFileInfo.Directory + "\\" + m.Groups[1].Captures[0].Value.ToString() + ".bib";
            }
            if (!File.Exists(path))
            {
                return;
            }

            //if (e.Text == @"\ref{")
            //{
            // open code completion after the user has pressed dot:
            completionWindow = new CompletionWindow(txtEditor.TextArea);
            // provide AvalonEdit with the data:
            IList <ICompletionData> data  = completionWindow.CompletionList.CompletionData;
            StringBuilder           entry = new StringBuilder();

            foreach (BibTex b in BibTex.Parse(path))
            {
                MyCompletionData d = new MyCompletionData(b.UID);
                d.Data = b.Text;
                //d.Description = "des";
                //d.Content = "content";
                data.Add(d);
            }
            completionWindow.Show();
            completionWindow.Closed += delegate
            {
                completionWindow = null;
            };
            //}
        }