1.1 --- a/SharpLibEar/Manager.cs Tue Aug 30 11:04:40 2016 +0200
1.2 +++ b/SharpLibEar/Manager.cs Tue Aug 30 16:50:37 2016 +0200
1.3 @@ -48,12 +48,12 @@
1.4 /// Trigger the given event.
1.5 /// </summary>
1.6 /// <param name="aEventType"></param>
1.7 - public void TriggerEvent<T>() where T: class
1.8 + public async void TriggerEvents<T>() where T: class
1.9 {
1.10 //Only trigger enabled events matching the desired type
1.11 foreach (Event e in Events.Where(e => e.GetType() == typeof(T) && e.Enabled))
1.12 {
1.13 - e.Trigger();
1.14 + await e.Trigger();
1.15 }
1.16 }
1.17
1.18 @@ -61,15 +61,36 @@
1.19 /// Trigger the given event.
1.20 /// </summary>
1.21 /// <param name="aEventType"></param>
1.22 - public void TriggerEvent<T>(T aEvent) where T : class
1.23 + public async void TriggerEvents<T>(T aEvent) where T : class
1.24 {
1.25 //Only trigger events matching the desired type
1.26 foreach (Event e in Events.Where(e => e.Equals(aEvent) && e.Enabled))
1.27 {
1.28 - e.Trigger();
1.29 + await e.Trigger();
1.30 }
1.31 }
1.32
1.33 + /// <summary>
1.34 + ///
1.35 + /// </summary>
1.36 + /// <typeparam name="T"></typeparam>
1.37 + /// <param name="aEvent"></param>
1.38 + public async void TriggerEventsByName(string aName)
1.39 + {
1.40 + if (string.IsNullOrEmpty(aName))
1.41 + {
1.42 + //Just don't do that that would be silly
1.43 + return;
1.44 + }
1.45 + //Only trigger events matching the desired type
1.46 + foreach (Event e in Events.Where(e => e.Name.Equals(aName)))
1.47 + {
1.48 + await e.Trigger();
1.49 + }
1.50 + }
1.51 +
1.52 +
1.53 +
1.54
1.55 /// <summary>
1.56 /// Remove the specified action from the event it belongs too.