Example #1
0
 /**
  * DEPRECATED. Obviously no longer in use, but not deleted so we can easily implement it again.
  */
 void HandleControllerEvent(object sender, ControllerEvent e)
 {
 }
Example #2
0
        /*
         * Event handling best practice from http://msdn.microsoft.com/en-us/library/w369ty8x.aspx
         */
        protected virtual void OnRaiseControllerEvent(ControllerEvent e)
        {
            // Make a temporary copy of the event to avoid possibility of
            // a race condition if the last subscriber unsubscribes
            // immediately after the null check and before the event is raised.
            EventHandler<ControllerEvent> handler = RaiseControllerEvent;

            // Event will be null if there are no subscribers
            if (handler != null)
            {
                // Use the () operator to raise the event.
                handler(this, e);
            }
        }