Exemple #1
0
        /// <summary>
        /// Subscribes to a specific input device event
        /// </summary>
        /// <param name="type">The event type to subscribe to.</param>
        /// <param name="delegateAction">The delegate that should be called</param>
        public void SubscribeKey(InputDeviceEventType type, Delegate delegateAction)
        {
            if (!this._inputEventSubscribers.ContainsKey(type))
            {
                this._inputEventSubscribers [type] = new List <Delegate> ();
            }

            this._inputEventSubscribers [type].Add(delegateAction);
        }
Exemple #2
0
        /// <summary>
        /// Unsubscribes the key.
        /// </summary>
        /// <param name="type">Type.</param>
        /// <param name="delegateAction">Delegate action.</param>
        public void UnsubscribeKey(InputDeviceEventType type, Delegate delegateAction)
        {
            if (!this._inputEventSubscribers.ContainsKey(type))
            {
                return;
            }

            this._inputEventSubscribers [type].Remove(delegateAction);
        }
Exemple #3
0
 /// <summary>
 /// Invokes the event.
 /// </summary>
 /// <param name="type">Type.</param>
 /// <param name="args">Arguments.</param>
 private void InvokeEvent(InputDeviceEventType type, params object[] args)
 {
     // invoke the mouse begin event
     if (this._inputEventSubscribers.ContainsKey(type))
     {
         List <Delegate> delegates = this._inputEventSubscribers[type];
         for (int i = 0; i < delegates.Count; i++)
         {
             delegates[i].DynamicInvoke(args);
         }
     }
 }