Beispiel #1
0
        private void Parse(string text)
        {
            var matches = LinkPattern.Matches(text);

            var index = 0;
            int len;

            foreach (Match m in matches)
            {
                len = m.Index - index;
                if (len > 0)
                {
                    ProcessText(text.Substring(index, len));
                }

                _inlines.Add(
                    new Run(m.Groups["link"].Value)
                {
                    Foreground      = Brushes.LightSkyBlue,
                    TextDecorations = TextDecorations.Underline,
                    Cursor          = Cursors.Hand
                }
                    );

                index = m.Index + m.Length;
            }

            len = text.Length - index;

            if (len > 0)
            {
                ProcessText(text.Substring(index, len));
            }
        }
Beispiel #2
0
 public IEnumerable <Tuple <int, string> > GetLinkPatternPositions()
 {
     if (string.IsNullOrEmpty(LinkPattern))
     {
         return(null);
     }
     return(LinkPattern.Split(';').Where(w => !string.IsNullOrEmpty(w)).Select(
                w => new Tuple <int, string>(int.Parse(w.Split(',').First()),
                                             Keys[Keys.IndexOf(Keys.Where(i => i.KeyName.Equals(w.Split(',').Last())).FirstOrDefault())].KeyValueIsInterval ? "&"
                                             + Keys[Keys.IndexOf(Keys.Where(i => i.KeyName.Equals(w.Split(',').Last())).FirstOrDefault())].KeyName + "_IntervalIndex&" :
                                             Keys[Keys.IndexOf(Keys.Where(i => i.KeyName.Equals(w.Split(',').Last())).FirstOrDefault())].KeyValue)));
 }