Exemplo n.º 1
0
 public void RemoveEvent(ZEvent item)
 {
     eventList.Remove(item);
 }
Exemplo n.º 2
0
 public static void RestoreEvent(ZEvent ev, ZComponent comp, string methodName)
 {
     if (comp == null || ev == null || ev.Owner == null) return;
     //if (ev.Owner is ZApplication || ev.Owner is Model) ev.Owner = comp;      //This would be too late: moved to restore
         
     // Find the field that is backing the event 
     // GetEvent would not work as we have to null and reset the event (the old delegate must be released)
     FieldInfo field = GetField(ev.Owner.GetType(), ev.EventName);            
     if (field != null)
         field.SetValue(ev.Owner, Delegate.CreateDelegate(field.FieldType, comp, methodName));
     else            
         Console.WriteLine("Field-like event not found {0} / {1}", ev.Owner.GetType().Name, ev.EventName);            
 } 
Exemplo n.º 3
0
 public void AddEvent(ZEvent item)
 {
     if (!eventList.Contains(item))
         eventList.Add(item);
 }