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