Published v0.11.0.0.
5 using System.Collections.Generic;
6 using System.ComponentModel;
8 using System.Reflection;
9 using System.Runtime.Serialization;
12 namespace SharpLib.Ear
14 [TypeConverter(typeof(TypeConverterJson<ManagerEventAction>))]
16 public class ManagerEventAction
18 public static ManagerEventAction Current = null;
19 //public IDictionary<string, Type> ActionTypes;
20 //public IDictionary<string, Type> EventTypes;
23 /// Our events instances.
26 public List<Event> Events;
31 public ManagerEventAction()
37 /// Executes after internalization took place.
43 Events = new List<Event>();
51 /// <param name="aEventType"></param>
52 public void TriggerEvent<T>() where T: class
54 //Only trigger enabled events matching the desired type
55 foreach (Event e in Events.Where(e => e.GetType() == typeof(T) && e.Enabled))
65 /// <param name="aAction"></param>
66 public void RemoveAction(Action aAction)
68 foreach (Event e in Events)
70 if (e.Actions.Remove(aAction))
72 //We removed our action, we are done here.