Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
OnExternalNote.cs
1using System.Threading.Tasks;
2using System.Xml;
6
8{
12 public abstract class OnExternalNote : OnNote
13 {
14 private ScriptableStringAttribute privilege;
15 private ScriptableStringAttribute sourceVariable;
16
21 : base()
22 {
23 }
24
28 [DefaultValueNull]
29 public string PrivilegeDefinition
30 {
31 get => this.privilege?.Definition;
32 set => this.privilege = new ScriptableStringAttribute(value, this);
33 }
34
38 [DefaultValueNull]
40 {
41 get => this.sourceVariable?.Definition;
42 set => this.sourceVariable = new ScriptableStringAttribute(value, this);
43 }
44
49 public override Task Parse(XmlElement Xml)
50 {
51 this.sourceVariable = new ScriptableStringAttribute(XML.Attribute(Xml, "sourceVariable"), this);
52 this.privilege = new ScriptableStringAttribute(XML.Attribute(Xml, "privilege"), this);
53
54 return base.Parse(Xml);
55 }
56
62 protected Task<string> GetSourceVariable(EvaluationArguments Arguments)
63 {
64 return this.sourceVariable.Evaluate(Arguments.Variables);
65 }
66
72 protected Task<string> GetPrivilege(EvaluationArguments Arguments)
73 {
74 return this.privilege.Evaluate(Arguments.Variables);
75 }
76 }
77}
Helps with common XML-related tasks.
Definition: XML.cs:19
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Definition: XML.cs:914
async Task< T > Evaluate(Variables Variables)
Evaluates the attribute
Contains information required for evaluating script in a state-machine.
Abstract base class for external note events.
override Task Parse(XmlElement Xml)
Parses the State-machine node.
OnExternalNote()
Abstract base class for external note events.
Task< string > GetSourceVariable(EvaluationArguments Arguments)
Evaluates the source variable to use (if any).
Task< string > GetPrivilege(EvaluationArguments Arguments)
Evaluates the privilege to require (if any).
Abstract base class for note events.
Definition: OnNote.cs:13