1.1 --- a/SharpLibEar/Event.cs Wed Aug 31 17:28:30 2016 +0200
1.2 +++ b/SharpLibEar/Event.cs Wed Aug 31 20:20:32 2016 +0200
1.3 @@ -4,6 +4,7 @@
1.4 using System;
1.5 using System.Collections.Generic;
1.6 using System.Diagnostics;
1.7 +using System.Linq;
1.8 using System.Runtime.Serialization;
1.9 using System.Threading.Tasks;
1.10
1.11 @@ -24,41 +25,6 @@
1.12 public bool Enabled { get; set; } = true;
1.13
1.14
1.15 - /// <summary>
1.16 - /// TODO: Should the name property be moved to our EAR Object?
1.17 - /// </summary>
1.18 - [DataMember]
1.19 - [AttributeObjectProperty
1.20 - (
1.21 - Id = "Event.Name",
1.22 - Name = "Name",
1.23 - Description = "Given event name. Can be used to trigger it."
1.24 - )
1.25 - ]
1.26 - public string Name { get; set; } = "";
1.27 -
1.28 -
1.29 - [DataMember]
1.30 - public List<Action> Actions = new List<Action>();
1.31 -
1.32 -
1.33 - protected override void DoConstruct()
1.34 - {
1.35 - base.DoConstruct();
1.36 -
1.37 - //Make sure our name is not null
1.38 - if (Name == null)
1.39 - {
1.40 - Name = "";
1.41 - }
1.42 -
1.43 - // TODO: Construct properties too
1.44 - foreach (Action a in Actions)
1.45 - {
1.46 - a.Construct();
1.47 - }
1.48 -
1.49 - }
1.50
1.51
1.52 /// <summary>
1.53 @@ -74,7 +40,7 @@
1.54 public async Task Trigger()
1.55 {
1.56 Trace.WriteLine("Event triggered: " + AttributeName);
1.57 - foreach (Action action in Actions)
1.58 + foreach (Action action in Objects.OfType<Action>())
1.59 {
1.60 await action.Execute();
1.61 }