/// <summary> /// Unregisters a SystemNotification. /// Be sure not to create new delegates when calling this method, but stored ones used when registering it. /// </summary> protected void UnregisterSystemNotification(GlobalDelegates.Delegate5 proc, SystemNotificationCode code) { int unregResult = MaxInterfaces.Global.UnRegisterNotification(proc, null, code); if (unregResult != 0 && this.systemNotifications != null) { this.systemNotifications.Remove(new Tuple<GlobalDelegates.Delegate5, SystemNotificationCode>(proc, code)); } }
public static void AddNewEventHandler(EventHandler e) { GlobalEventHandlers.Add(e); GlobalDelegates.Add(new KeyValuePair <EventHandler, Delegate[]>(e, e.GetInvocationList())); }
/// <summary> /// Registers a SystemNotification proc, which will be automatically unregistered when UnregisterSystemNotifications is called. /// </summary> protected void RegisterSystemNotification(GlobalDelegates.Delegate5 proc, SystemNotificationCode code) { if (this.systemNotifications == null) this.systemNotifications = new List<Tuple<GlobalDelegates.Delegate5, SystemNotificationCode>>(); int regResult = MaxInterfaces.Global.RegisterNotification(proc, null, code); if (regResult != 0) this.systemNotifications.Add(new Tuple<GlobalDelegates.Delegate5, SystemNotificationCode>(proc, code)); }