Ejemplo n.º 1
0
        /// Remove the current event from the event handler
        public static void Remove <T>(this IEventApi self) where T : class, IEvent
        {
            var handler = self.EventHandler <T>();

            if (handler != null)
            {
                self.EventListener.RemoveEventHandler(self.EventHandler <T>());
            }
        }
Ejemplo n.º 2
0
        /// Push the current event back into the event handler.
        /// Useful for one-shot event handlers that don't want to expired.
        public static void Keep <T>(this IEventApi self) where T : class, IEvent
        {
            var handler = self.EventHandler <T>();

            if (handler != null)
            {
                if (!self.EventListener.ContainsEventHandler(handler))
                {
                    self.EventListener.AddEventHandler(handler);
                }
            }
        }