Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
MediaParameter.cs
1using System.Threading.Tasks;
2using System.Xml;
9using Waher.Script;
10
12{
17 {
18 private readonly ReportStringAttribute url;
19 private readonly ReportStringAttribute contentType;
20 private readonly ReportUInt16Attribute width;
21 private readonly ReportUInt16Attribute height;
22
27 public MediaParameter(XmlElement Xml)
28 : base(Xml)
29 {
30 this.url = new ReportStringAttribute(Xml, "url");
31 this.contentType = new ReportStringAttribute(Xml, "contentType");
32 this.width = new ReportUInt16Attribute(Xml, "width");
33 this.height = new ReportUInt16Attribute(Xml, "height");
34 }
35
43 {
44 ReportParameterAttributes Attributes = await this.GetReportParameterAttributes(Variables);
45 string Url = await this.url.Evaluate(Variables);
46 string ContentType = await this.contentType.Evaluate(Variables);
47 ushort? Width = this.width.IsEmpty ? null : (ushort?)await this.width.Evaluate(Variables);
48 ushort? Height = this.height.IsEmpty ? null : (ushort?)await this.height.Evaluate(Variables);
49
50 Media Media = new Media(Url, ContentType, Width, Height);
51 MediaField Field = new MediaField(Attributes.Name, Attributes.Label, Media);
52
53 Parameters.Add(Field);
54
55 Page Page = Parameters.GetPage(Attributes.Page);
56 Page.Add(Field);
57 }
58
68 public override Task SetParameter(DataForm Parameters, Language Language, bool OnlySetChanged, Variables Variables,
70 {
71 return Task.CompletedTask;
72 }
73
74 }
75}
Static class managing editable parameters in objects. Editable parameters are defined by using the at...
Definition: Parameters.cs:26
Implements support for data forms. Data Forms are defined in the following XEPs:
Definition: DataForm.cs:42
Base class for form fields
Definition: Field.cs:17
Class managing a page in a data form layout.
Definition: Page.cs:11
void Add(LayoutElement Element)
Adds a layout element.
Definition: Section.cs:135
Class containing information about media content in a data form.
Definition: Media.cs:18
Represents a media-valued parameter.
MediaParameter(XmlElement Xml)
Represents a media-valued parameter.
override Task SetParameter(DataForm Parameters, Language Language, bool OnlySetChanged, Variables Variables, SetEditableFormResult Result)
Sets the parameters of the object, based on contents in the data form.
override async Task PopulateForm(DataForm Parameters, Language Language, Variables Variables)
Populates a data form with parameters for the object.
Abstract base class for report parameters.
async Task< ReportParameterAttributes > GetReportParameterAttributes(Variables Variables)
Evaluates the attributes of the report parameter.
Contains information about a language.
Definition: Language.cs:17
Collection of variables.
Definition: Variables.cs:25