1using System.Threading.Tasks;
3using System.Windows.Controls;
4using System.Windows.Markup;
24 if (
string.IsNullOrEmpty(Xaml))
27 object Result = XamlReader.Parse(Xaml);
29 if (Result is StackPanel Panel && Panel.Children.Count == 1)
31 UIElement Child = Panel.Children[0];
32 Panel.Children.RemoveAt(0);
34 if (Child is FrameworkElement E)
35 E.Margin =
new Thickness(0);
87 return await Doc.GenerateXAML();
99 return await Doc.GenerateXAML();
123 return (await
Role.ToXAML(Language,
Contract)).ParseSimple();
147 return (await
Contract.ToXAML(Text, Language)).ParseSimple();
159 return (await
Contract.ToXAML(
Label, Language)).ParseSimple();
171 if (
string.IsNullOrEmpty(Markdown))
175 string Xaml = await Text.GenerateXAML(
Contract);
176 return Xaml.ParseSimple();
188 if (
string.IsNullOrEmpty(Markdown))
192 string Xaml = await Text.GenerateXAML(
Contract);
193 return XamlReader.
Parse(Xaml);
Static class with XAML extensions.
static async Task< object > ToSimpleXAML(this Role Role, string Language, Contract Contract)
Converts the human-readable description of a role to simple XAML.
static Task< string > ToXAML(this Contract Contract, HumanReadableText[] Text, string Language)
Selects a human-readable text, and generates a XAML document from it.
static Task< string > ToXAML(this Contract Contract, Waher.Networking.XMPP.Contracts.HumanReadable.Label[] Text, string Language)
Selects a human-readable text, and generates a XAML document from it.
static async Task< object > ToSimpleXAML(this Parameter Parameter, string Language, Contract Contract)
Converts the human-readable description of a parameter to simple XAML.
static async Task< object > ToSimpleXAML(this Waher.Networking.XMPP.Contracts.HumanReadable.Label[] Label, string Language, Contract Contract)
Converts the human-readable label of a parameter to simple XAML.
static async Task< object > ToSimpleXAML(this HumanReadableText[] Text, string Language, Contract Contract)
Converts the human-readable description of a parameter to simple XAML.
static object ParseSimple(this string Xaml)
Parses a string into simple XAML (for inclusion in tables, tooltips, etc.)
static async Task< object > ToXAML(this string Markdown, Contract Contract, string Language)
Converts the human-readable description of a parameter to XAML.
static async Task< string > GenerateXAML(this Waher.Networking.XMPP.Contracts.HumanReadable.Label Text, Contract Contract)
Generates XAML for the human-readable text.
static async Task< string > GenerateXAML(this HumanReadableText Text, Contract Contract)
Generates XAML for the human-readable text.
static Task< string > ToXAML(this LocalizableDescription Description, string Language, Contract Contract)
Creates a human-readable XAML document for the contract.
static async Task< object > ToSimpleXAML(this string Markdown, Contract Contract, string Language)
Converts the human-readable description of a parameter to simple XAML.
static Task< string > ToXAML(this Contract Contract, string Language)
Creates a human-readable XAML document for the contract.
Contains a markdown document. This markdown document class supports original markdown,...
Contains the definition of a contract
HumanReadableText[] ForHumans
Human-readable contents of the contract.
HumanReadableText Select(HumanReadableText[] Text, string Language)
Selects a human-readable text, from a collection of texts, based on currently selected language.
Class representing human-readable text.
static HumanReadableText Parse(XmlElement Xml)
Class representing human-readable text.
async Task< MarkdownDocument > GenerateMarkdownDocument(Contract Contract)
Generates a parsed markdown document for the human-readable text.
Abstract base class for contractual parameters
HumanReadableText[] Descriptions
Discriptions of the object, in different languages.
Abstract base class for contractual parameters