public static void UnregisterEvent(Event eve, Delegate fire) { List<Delegate> delegates = new List<Delegate>(); if (EventXDelegate.ContainsKey(eve)) { if (EventXDelegate.ContainsKey(eve)) { EventXDelegate[eve].Remove(fire); APIServer.Log.Info("Unregistered event!"); } } else { APIServer.Log.Info("failed to unregister event!"); } }
public static void FireEvent(Event ev, EventArguments args) { if (EventXDelegate.ContainsKey(ev)) { List<Delegate> delegates = EventXDelegate[ev]; foreach (Delegate d in delegates.ToList()) { d.DynamicInvoke(new object[] { args }); } } }
public static void RegisterEvent(Event eve, Delegate fire) { List<Delegate> delegates = new List<Delegate>(); if (EventXDelegate.ContainsKey(eve)) { EventXDelegate[eve].Add(fire); } else { delegates.Add(fire); EventXDelegate.Add(eve, delegates); } }