Пример #1
0
        /// <summary>
        /// Unregisters previously registered hot key.
        /// </summary>
        /// <param name="hotKey">The registered hot key.</param>
        public void Unregister(HotKey hotKey)
        {
            int id;

            if (_registered.TryGetValue(hotKey, out id))
            {
                WinApi.UnregisterHotKey(_windowHandleSource.Handle, id);
                _registered.Remove(hotKey);
            }
        }
Пример #2
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            // Unregister hot keys.
            foreach (var hotKey in _registered)
            {
                WinApi.UnregisterHotKey(_windowHandleSource.Handle, hotKey.Value);
            }

            _windowHandleSource.RemoveHook(messagesHandler);
            _windowHandleSource.Dispose();
        }
Пример #3
0
 public static bool Unregister(HotKey hotKey)
 {
     keyMap.Remove(hotKey.id);
     return(WinApi.UnregisterHotKey(handle, hotKey.id));
 }