Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
MailMessage.cs
1
using
System.Threading.Tasks;
2
using
System.Xml;
3
using
Waher.Content.Markdown
;
4
using
Waher.Service.IoTBroker.StateMachines.Model.Actions.Payments
;
5
6
namespace
Waher.Service.IoTBroker.StateMachines.Model.Actions.Outbound
7
{
11
public
class
MailMessage
:
ActionNode
12
{
13
private
To
to;
14
private
Subject
subject;
15
private
Notes.Content
content;
16
20
public
MailMessage
()
21
: base()
22
{
23
}
24
28
public
To
To
=> this.to;
29
33
public
Subject
Subject
=> this.subject;
34
38
public
Notes.Content
Content
=> this.content;
39
43
public
override
string
LocalName
=> nameof(
MailMessage
);
44
49
public
override
IStateMachineNode
Create
()
50
{
51
return
new
MailMessage
();
52
}
53
58
public
override
async Task
Parse
(XmlElement Xml)
59
{
60
await base.Parse(Xml);
61
62
this.
ConvertValueAttributesToElements
(Xml,
63
new
System.Type[]
64
{
65
typeof(To),
66
typeof(Subject),
67
typeof(Notes.Content)
68
},
69
new
bool
[]
70
{
71
true,
72
true,
73
true
74
});
75
}
76
80
protected
override
void
OnChildNodesUpdated
()
81
{
82
base.OnChildNodesUpdated();
83
84
this.to = this.GetValueElement<To>();
85
this.subject = this.GetValueElement<Subject>();
86
this.content = this.GetValueElement<Notes.Content>();
87
}
88
93
public
override
async Task
Execute
(
EvaluationArguments
Arguments)
94
{
95
string
To
= (await this.to.
Evaluate
(Arguments))?.ToString();
96
string
Subject
= ((await this.subject.
Evaluate
(Arguments))?.ToString()) ??
"N/A"
;
97
object
Content
= await this.content.
Evaluate
(Arguments);
98
99
if
(!(
Content
is
string
Markdown))
100
{
101
if
(
Content
is
null
)
102
Markdown =
"N/A"
;
103
else
if
(
Content
is
MarkdownContent
MarkdownContent
)
104
Markdown =
MarkdownContent
.
Markdown
;
105
else
106
Markdown =
Content
.ToString();
107
}
108
109
await
XmppServerModule
.
SendMailMessage
(
To
,
Subject
, Markdown);
110
}
111
}
112
}
Waher.Content.Markdown.MarkdownContent
Class that can be used to encapsulate Markdown to be returned from a Web Service, bypassing any encod...
Definition:
MarkdownContent.cs:11
Waher.Content.Markdown.MarkdownContent.Markdown
string Markdown
Markdown content.
Definition:
MarkdownContent.cs:40
Waher.Service.IoTBroker.StateMachines.Model.Actions.ActionNode
Abstract base class for State-Machine action nodes.
Definition:
ActionNode.cs:9
Waher.Service.IoTBroker.StateMachines.Model.Actions.Notes.Content
Defines note content.
Definition:
Content.cs:9
Waher.Service.IoTBroker.StateMachines.Model.Actions.Outbound.MailMessage
Defines a Mail action
Definition:
MailMessage.cs:12
Waher.Service.IoTBroker.StateMachines.Model.Actions.Outbound.MailMessage.Parse
override async Task Parse(XmlElement Xml)
Parses the State-machine node.
Definition:
MailMessage.cs:58
Waher.Service.IoTBroker.StateMachines.Model.Actions.Outbound.MailMessage.OnChildNodesUpdated
override void OnChildNodesUpdated()
Method called whenever ChildNodes is updated.
Definition:
MailMessage.cs:80
Waher.Service.IoTBroker.StateMachines.Model.Actions.Outbound.MailMessage.LocalName
override string LocalName
Local name
Definition:
MailMessage.cs:43
Waher.Service.IoTBroker.StateMachines.Model.Actions.Outbound.MailMessage.Create
override IStateMachineNode Create()
Creates a new node of the corresponding type.
Definition:
MailMessage.cs:49
Waher.Service.IoTBroker.StateMachines.Model.Actions.Outbound.MailMessage.MailMessage
MailMessage()
Defines a Mail action
Definition:
MailMessage.cs:20
Waher.Service.IoTBroker.StateMachines.Model.Actions.Outbound.MailMessage.Content
Notes.Content Content
Content value
Definition:
MailMessage.cs:38
Waher.Service.IoTBroker.StateMachines.Model.Actions.Outbound.MailMessage.Execute
override async Task Execute(EvaluationArguments Arguments)
Evaluates the action node
Definition:
MailMessage.cs:93
Waher.Service.IoTBroker.StateMachines.Model.Actions.Outbound.Subject
Defines a subject.
Definition:
Subject.cs:9
Waher.Service.IoTBroker.StateMachines.Model.Actions.Payments.To
Defines to whom a payment (or message) is sent.
Definition:
To.cs:9
Waher.Service.IoTBroker.StateMachines.Model.EvaluationArguments
Contains information required for evaluating script in a state-machine.
Definition:
EvaluationArguments.cs:15
Waher.Service.IoTBroker.StateMachines.Model.StateMachineNode.ConvertValueAttributesToElements
void ConvertValueAttributesToElements(XmlElement Xml, Type[] ValueTypes, bool[] Required)
Converts value attributes to parsed elements. The XML definition has to be parsed before,...
Definition:
StateMachineNode.cs:194
Waher.Service.IoTBroker.StateMachines.Model.Values.Value.Evaluate
Task< object > Evaluate(EvaluationArguments Arguments)
Evaluates the value node.
Definition:
Value.cs:146
Waher.Service.IoTBroker.XmppServerModule
Service Module hosting the XMPP broker and its components.
Definition:
XmppServerModule.cs:109
Waher.Service.IoTBroker.XmppServerModule.SendMailMessage
static Task< bool > SendMailMessage(string To, string Subject, string Markdown)
Sends a mail message
Definition:
XmppServerModule.cs:4680
Waher.Service.IoTBroker.StateMachines.Model.IStateMachineNode
Interface for State-Machine nodes
Definition:
IStateMachineNode.cs:11
Waher.Content.Markdown
Definition:
ConsolidatedTable.cs:11
Waher.Service.IoTBroker.StateMachines.Model.Actions.Outbound
Definition:
Header.cs:5
Waher.Service.IoTBroker.StateMachines.Model.Actions.Payments
Definition:
Amount.cs:4
Waher.Service.IoTBroker
StateMachines
Model
Actions
Outbound
MailMessage.cs
Generated by
1.9.5