Exemplo n.º 1
0
        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!");
            }
        }
Exemplo n.º 2
0
 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 });
         }
     }
 }
Exemplo n.º 3
0
        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);
            }
        }