public void RemoveEvent(ZEvent item) { eventList.Remove(item); }
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); }
public void AddEvent(ZEvent item) { if (!eventList.Contains(item)) eventList.Add(item); }