Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
XmppUriScheme.cs
1using System.Xml;
6
8{
13 {
18 {
19 }
20
22 public override Grade Supports(MultimediaItem Item)
23 {
24 if (Item.Url.StartsWith("xmpp:", StringComparison.OrdinalIgnoreCase))
25 return Grade.Excellent;
26 else
27 return Grade.NotAtAll;
28 }
29
31 public override bool EmbedInlineLink(string Url)
32 {
33 return true;
34 }
35
37 public async Task RenderMauiXaml(MauiXamlRenderer Renderer, MultimediaItem[] Items, IEnumerable<MarkdownElement> ChildNodes, bool AloneInParagraph, MarkdownDocument Document)
38 {
39 XmlWriter Output = Renderer.XmlOutput;
40
41 foreach (MultimediaItem Item in Items)
42 {
43 Output.WriteStartElement("VerticalStackLayout");
44 Output.WriteAttributeString("HorizontalOptions", "Center");
45
46 Output.WriteStartElement("Path");
47 Output.WriteAttributeString("VerticalOptions", "Center");
48 Output.WriteAttributeString("HorizontalOptions", "Center");
49 Output.WriteAttributeString("HeightRequest", "16");
50 Output.WriteAttributeString("WidthRequest", "16");
51 Output.WriteAttributeString("Aspect", "Uniform");
52 Output.WriteAttributeString("Fill", "{AppThemeBinding Light={StaticResource PrimaryForegroundLight}, Dark={StaticResource PrimaryForegroundDark}}");
53 Output.WriteAttributeString("Data", "{x:Static ui:Geometries.PersonPath}");
54 Output.WriteEndElement();
55
56 Output.WriteStartElement("VerticalStackLayout");
57 Output.WriteAttributeString("HorizontalOptions", "Center");
58
59 Output.WriteStartElement("Label");
60 Output.WriteAttributeString("LineBreakMode", "WordWrap");
61 Output.WriteAttributeString("TextType", "Html");
62 Output.WriteAttributeString("FontSize", "Medium");
63
64 using HtmlRenderer Html = new(new HtmlSettings()
65 {
66 XmlEntitiesOnly = true
67 });
68
69 foreach (MarkdownElement E in ChildNodes)
70 await E.Render(Html);
71
72 Output.WriteValue(Html.ToString());
73 Output.WriteEndElement();
74
75 Output.WriteEndElement();
76
77 Output.WriteStartElement("VerticalStackLayout.GestureRecognizers");
78
79 Output.WriteStartElement("TapGestureRecognizer");
80 Output.WriteAttributeString("Command", "{Binding Path=XmppUriClicked}");
81 Output.WriteAttributeString("CommandParameter", Item.Url);
82 Output.WriteEndElement();
83
84 Output.WriteEndElement();
85 Output.WriteEndElement();
86 break;
87 }
88 }
89 }
90}
Renders XAML (Maui flavour) from a Markdown document.
Implements the XMPP URI Scheme, as defined in XEP-0147: https://xmpp.org/extensions/xep-0147....
override bool EmbedInlineLink(string Url)
If the link provided should be embedded in a multi-media construct automatically.
async Task RenderMauiXaml(MauiXamlRenderer Renderer, MultimediaItem[] Items, IEnumerable< MarkdownElement > ChildNodes, bool AloneInParagraph, MarkdownDocument Document)
Generates Maui XAML for the multimedia content.
override Grade Supports(MultimediaItem Item)
Checks how well the handler supports multimedia content of a given type. How well the handler support...
XmppUriScheme()
Implements the XMPP URI Scheme, as defined in XEP-0147: https://xmpp.org/extensions/xep-0147....
Contains a markdown document. This markdown document class supports original markdown,...
Abstract base class for all markdown elements.
abstract Task Render(IRenderer Output)
Renders the element.
Abstract base class for multimedia content.
Renders HTML from a Markdown document.
Definition: HtmlRenderer.cs:24
Contains settings that the HTML export uses to customize HTML output.
Definition: HtmlSettings.cs:7
Abstract base class for Markdown renderers.
Definition: Renderer.cs:14
Interface for multimedia content Maui XAML renderers.
Grade
Grade enumeration
Definition: Grade.cs:7