author | StephaneLenclud |
Sat, 23 Jul 2016 16:00:04 +0200 | |
changeset 210 | 83dd86e73448 |
child 211 | 96f8b4dc4300 |
permissions | -rw-r--r-- |
StephaneLenclud@210 | 1 |
// |
StephaneLenclud@210 | 2 |
|
StephaneLenclud@210 | 3 |
|
StephaneLenclud@210 | 4 |
using System; |
StephaneLenclud@210 | 5 |
using System.Collections.Generic; |
StephaneLenclud@210 | 6 |
using System.Linq; |
StephaneLenclud@210 | 7 |
using System.Reflection; |
StephaneLenclud@210 | 8 |
using System.Runtime.Serialization; |
StephaneLenclud@210 | 9 |
|
StephaneLenclud@210 | 10 |
namespace SharpLib.Ear |
StephaneLenclud@210 | 11 |
{ |
StephaneLenclud@210 | 12 |
[DataContract] |
StephaneLenclud@210 | 13 |
public class EventActionManager |
StephaneLenclud@210 | 14 |
{ |
StephaneLenclud@210 | 15 |
public static EventActionManager Current = null; |
StephaneLenclud@210 | 16 |
public IDictionary<string, Type> ActionTypes; |
StephaneLenclud@210 | 17 |
private IDictionary<string, Event> Events; |
StephaneLenclud@210 | 18 |
|
StephaneLenclud@210 | 19 |
public EventActionManager() |
StephaneLenclud@210 | 20 |
{ |
StephaneLenclud@210 | 21 |
ActionTypes = Utils.Reflection.GetConcreteClassesDerivedFromByName<Action>(); |
StephaneLenclud@210 | 22 |
Events = Utils.Reflection.GetConcreteClassesInstanceDerivedFromByName<Event>(); |
StephaneLenclud@210 | 23 |
} |
StephaneLenclud@210 | 24 |
|
StephaneLenclud@210 | 25 |
public Event GetEvent<T>() where T : class |
StephaneLenclud@210 | 26 |
{ |
StephaneLenclud@210 | 27 |
return Events[typeof(T).Name]; |
StephaneLenclud@210 | 28 |
} |
StephaneLenclud@210 | 29 |
|
StephaneLenclud@210 | 30 |
} |
StephaneLenclud@210 | 31 |
} |