コード例 #1
0
 /// <summary>
 /// Removes the specified callbacks from the specified key
 /// </summary>
 /// <param name="key"></param>
 /// <param name="callbacks"></param>
 public void RemoveKeyboardHook(Keys key, HookCallbacks callbacks)
 {
     if (_hooks.ContainsKey(key))
     {
         _hooks[key].Remove(callbacks);
     }
 }
コード例 #2
0
        /// <summary>
        /// Hooks the specified keypress and call the specified callbacks when keypress occurs
        /// </summary>
        /// <param name="key"></param>
        /// <param name="callbacks"></param>
        public void SetKeyboardHook(Keys key, HookCallbacks callbacks)
        {
            if (!_hooks.ContainsKey(key))
            {
                _hooks.Add(key, new List <HookCallbacks>());
            }

            _hooks[key].Add(callbacks);
        }