Ejemplo n.º 1
0
        /// <inheritdoc/>
        protected override void Write([NotNull] WpfRenderer renderer, [NotNull] AutolinkInline link)
        {
            var url = link.Url;

            if (link.IsEmail)
            {
                url = "mailto:" + url;
            }

            if (!Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute))
            {
                url = "#";
            }

            var hyperlink = new Hyperlink
            {
                Command          = Commands.Hyperlink,
                CommandParameter = url,
                NavigateUri      = new Uri(url, UriKind.RelativeOrAbsolute),
                ToolTip          = link.Url,
            };

            hyperlink.SetResourceReference(FrameworkContentElement.StyleProperty, Styles.HyperlinkStyleKey);

            renderer.Push(hyperlink);
            renderer.WriteText(link.Url);
            renderer.Pop();
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        protected override void Write([NotNull] WpfRenderer renderer, [NotNull] LiteralInline obj)
        {
            if (obj.Content.IsEmpty)
            {
                return;
            }

            renderer.WriteText(ref obj.Content);
        }
Ejemplo n.º 3
0
 /// <inheritdoc/>
 protected override void Write([NotNull] WpfRenderer renderer, [NotNull] LineBreakInline obj)
 {
     if (obj.IsHard)
     {
         renderer.WriteInline(new LineBreak());
     }
     else
     {
         // Soft line break.
         renderer.WriteText(" ");
     }
 }
Ejemplo n.º 4
0
        /// <inheritdoc/>
        protected override void Write(WpfRenderer renderer, DelimiterInline obj)
        {
            if (renderer == null)
            {
                throw new ArgumentNullException(nameof(renderer));
            }
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            renderer.WriteText(obj.ToLiteral());
            renderer.WriteChildren(obj);
        }
        protected override void Write(WpfRenderer renderer, HtmlEntityInline obj)
        {
            if (renderer == null)
            {
                throw new ArgumentNullException(nameof(renderer));
            }
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            var transcoded = obj.Transcoded;

            renderer.WriteText(ref transcoded);
        }
Ejemplo n.º 6
0
        /// <inheritdoc/>
        protected override void Write(WpfRenderer renderer, LiteralInline obj)
        {
            if (renderer == null)
            {
                throw new ArgumentNullException(nameof(renderer));
            }
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            if (obj.Content.IsEmpty)
            {
                return;
            }

            renderer.WriteText(ref obj.Content);
        }
Ejemplo n.º 7
0
        /// <inheritdoc/>
        protected override void Write(WpfRenderer renderer, LineBreakInline obj)
        {
            if (renderer == null)
            {
                throw new ArgumentNullException(nameof(renderer));
            }
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            if (obj.IsHard)
            {
                renderer.WriteInline(new LineBreak());
            }
            else
            {
                // Soft line break.
                renderer.WriteText(" ");
            }
        }
Ejemplo n.º 8
0
 /// <inheritdoc/>
 protected override void Write([NotNull] WpfRenderer renderer, [NotNull] DelimiterInline obj)
 {
     renderer.WriteText(obj.ToLiteral());
     renderer.WriteChildren(obj);
 }
Ejemplo n.º 9
0
        protected override void Write([NotNull] WpfRenderer renderer, [NotNull] HtmlEntityInline obj)
        {
            var transcoded = obj.Transcoded;

            renderer.WriteText(ref transcoded);
        }