Beispiel #1
0
 public static List <Inline> UnicodeToInlines(string str, int size)
 {
     if (str == null)
     {
         return(null);
     }
     return(SingleEmojiRegex.Split(str).Select(s => GetInlineWithString(s, size)).ToList());
 }
Beispiel #2
0
        public static Inline GetInlineWithString(string str, int size)
        {
            if (!SingleEmojiRegex.IsMatch(str))
            {
                return(new Run(presentationSelectors.Replace(str, "")));
            }
            var path = UnicodeToImageUrlCallback(str);

            if (path == null)
            {
                return(new Run(presentationSelectors.Replace(str, "")));
            }
            var image = new Image {
                Source = new BitmapImage(new Uri(path)),
                Height = size,
                Width  = size,
                Margin = new System.Windows.Thickness {
                    Left = 2, Right = 2, Top = 0, Bottom = 0
                }
            };

            return(new InlineUIContainer(image));
        }