Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
FixedParameter.cs
2using System.Threading.Tasks;
3using System.Xml;
10using Waher.Script;
11
13{
18 {
19 private readonly ReportStringAttribute[] value;
20 private readonly int nrValues;
21
26 public FixedParameter(XmlElement Xml)
27 : base(Xml)
28 {
29 List<ReportStringAttribute> Values = new List<ReportStringAttribute>();
30
31 foreach (XmlNode N in Xml.ChildNodes)
32 {
33 if (N is XmlElement E && E.LocalName == "Value")
34 Values.Add(new ReportStringAttribute(E, null));
35 }
36
37 this.value = Values.ToArray();
38 this.nrValues = this.value.Length;
39 }
40
48 {
49 ReportParameterAttributes Attributes = await this.GetReportParameterAttributes(Variables);
50
51 FixedField Field = new FixedField(Parameters, Attributes.Name, Attributes.Label, Attributes.Required,
52 await this.GetValue(Variables), null, Attributes.Description, null, null, string.Empty,
53 false, false, false);
54
55 Parameters.Add(Field);
56
57 Page Page = Parameters.GetPage(Attributes.Page);
58 Page.Add(Field);
59 }
60
61 private async Task<string[]> GetValue(Variables Variables)
62 {
63 string[] Value = new string[this.nrValues];
64 int i;
65
66 for (i = 0; i < this.nrValues; i++)
67 Value[i] = await this.value[i].Evaluate(Variables);
68
69 return Value;
70 }
71
81 public override async Task SetParameter(DataForm Parameters, Language Language, bool OnlySetChanged, Variables Variables,
83 {
84 string Name = await this.GetName(Variables);
85 Variables[Name] = await this.GetValue(Variables);
86 }
87
88 }
89}
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
Represents a fixed-valued parameter.
override async Task PopulateForm(DataForm Parameters, Language Language, Variables Variables)
Populates a data form with parameters for the object.
override async 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.
FixedParameter(XmlElement Xml)
Represents a fixed-valued parameter.
Abstract base class for report parameters.
async Task< ReportParameterAttributes > GetReportParameterAttributes(Variables Variables)
Evaluates the attributes of the report parameter.
Task< string > GetName(Variables Variables)
Name of the parameter.
Contains information about a language.
Definition: Language.cs:17
Collection of variables.
Definition: Variables.cs:25