Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ReportParameterWithOptions.cs
2using System.Threading.Tasks;
3using System.Xml;
6using Waher.Script;
7
9{
14 {
15 private readonly ReportBooleanAttribute restrictToOptions;
16 private readonly IParameterOptions[] options;
17
22 public ReportParameterWithOptions(XmlElement Xml)
23 : base(Xml)
24 {
25 this.restrictToOptions = new ReportBooleanAttribute(Xml, "restrictToOptions");
26
28
29 foreach (XmlNode N in Xml.ChildNodes)
30 {
31 if (!(N is XmlElement E2))
32 continue;
33
34 switch (E2.LocalName)
35 {
36 case "Option":
37 Options2.Add(new ParameterOption(E2));
38 break;
39
40 case "ScriptOptions":
41 Options2.Add(new ParameterScriptOptions(E2));
42 break;
43 }
44 }
45
46 this.options = Options2.ToArray();
47 }
48
54 public async Task<ReportParameterWithOptionsAttributes> GetReportParameterWithOptionsAttributes(Variables Variables)
55 {
58
59 foreach (IParameterOptions Option in this.options)
60 Options.AddRange(await Option.GetOptions(Variables));
61
63 {
64 Page = Base.Page,
65 Name = Base.Name,
66 Label = Base.Label,
67 Description = Base.Description,
68 Required = Base.Required,
69 RestrictToOptions = await this.restrictToOptions.Evaluate(Variables, false),
70 Options = Options.ToArray()
71 };
72 }
73
74 }
75}
Represents a parameter with possible options on a command.
async Task< ReportParameterWithOptionsAttributes > GetReportParameterWithOptionsAttributes(Variables Variables)
Evaluates the attributes of the report parameter with options.
ReportParameterWithOptions(XmlElement Xml)
Represents a parameter with possible options on a command.
Abstract base class for report parameters.
async Task< ReportParameterAttributes > GetReportParameterAttributes(Variables Variables)
Evaluates the attributes of the report parameter.
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
void AddRange(IEnumerable< T > Collection)
Adds a range of elements (last) to the list.
Collection of variables.
Definition: Variables.cs:25
Interface for classes implementing parameter options.
Task< KeyValuePair< string, string >[]> GetOptions(Variables Variables)
Gets the options for the parameter.