Guest User

Untitled

a guest
Jun 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. string[] messageSplit = message.Split(' ');
  2. FlowDocument doc = new FlowDocument();
  3. Paragraph paragraph = new Paragraph();
  4.  
  5. for (int i = 0; i < messageSplit.Length; ++i) {
  6. string str = messageSplit[i];
  7. if (str.Contains("${emoteId=")) {
  8.  
  9. string id = ...
  10. Image image = new Image();
  11. image.Source = (ImageSource)((new ImageSourceConverter()).ConvertFromString($@"emotes/{id}.png"));
  12.  
  13. BlockUIContainer cont = new BlockUIContainer(image);
  14. Figure figure = new Figure(cont);
  15. figure.Width = (new FigureLength(24));
  16. figure.WrapDirection = WrapDirection.Both;
  17. figure.VerticalAnchor = FigureVerticalAnchor.PageTop;
  18. figure.HorizontalAnchor = FigureHorizontalAnchor.PageLeft;
  19.  
  20. paragraph.Inlines.Add(figure);
  21. } else {
  22. paragraph.Inlines.Add(new Run(str));
  23. }
  24. doc.Blocks.Add(paragraph);
  25. MessageText.Document = doc;
Add Comment
Please, Sign In to add comment