Beispiel #1
0
 public void On(string eventName, EventHandler handler)
 {
     if (!EventHandlers.ContainsKey(eventName))
     {
         EventHandlers.Add(eventName, handler);
     }
 }
 protected void AddEvent(string eventKey, Action <UIEvent> handler)
 {
     if (!EventHandlers.ContainsKey(eventKey))
     {
         EventHandlers.Add(eventKey, handler);
     }
 }
 /**
  * Returning true means do everything as normal or no event was caught
  */
 public void ProcessEvent(UIEvent e)
 {
     if (EventHandlers.ContainsKey(e.EventKey))
     {
         EventHandlers[e.EventKey](e);
     }
 }
Beispiel #4
0
 public void Off(string eventName)
 {
     if (EventHandlers.ContainsKey(eventName))
     {
         EventHandlers.Remove(eventName);
     }
 }
Beispiel #5
0
 public void On(string eventName, EventHandler handler)
 {
     if (EventHandlers.ContainsKey(eventName))
     {
         Console.WriteLine(string.Format("{0} is already on !", eventName));
         return;
     }
     EventHandlers.Add(eventName, handler);
 }
        public void ApplyEvents(IEnumerable <IEvent> events)
        {
            if (events.Any(e => !EventHandlers.ContainsKey(e.GetType())))
            {
                throw new Exception("Attempt to apply and unknown event type.");
            }

            foreach (var @event in events)
            {
                EventHandlers[@event.GetType()].Invoke(@event);
            }
        }
Beispiel #7
0
        public void AddConnectorEventHandler(string eventKey, string controlName, string connectorName)
        {
            if (!EventHandlers.ContainsKey(eventKey))
            {
                EventHandlers.Add(eventKey, new EventHandlerCollection());
            }

            EventHandlerSchema ehs = new EventHandlerSchema();

            ehs.ControlName   = controlName;
            ehs.ConnectorName = connectorName;

            EventHandlers[eventKey].Add(ehs);
        }