5 using System.Collections.Generic;
6 using System.Diagnostics;
8 using System.Runtime.Serialization;
9 using System.Threading.Tasks;
11 namespace SharpLib.Ear
14 [AttributeObject(Id = "Event", Name = "User Event", Description = "An event that can be triggered by users.")]
15 public class Event : Object
18 [AttributeObjectProperty
22 Description = "When enabled an event instance can be triggered."
25 public bool Enabled { get; set; } = true;
31 /// Allows testing from generic edit dialog.
33 public async void Test()
35 Trace.WriteLine("Event test");
40 public async Task Trigger()
42 Trace.WriteLine("Event triggered: " + AttributeName);
43 foreach (Action action in Objects.OfType<Action>())
45 await action.Execute();
50 public override bool Equals(object obj)
52 //Default implementation assumes event are the same if types are the same
53 bool res= obj.GetType() == GetType();