Esempio n. 1
0
 public void Dispose()
 {
     if (!_disposed)
     {
         Win32.UnregisterHotKey(IntPtr.Zero, _id);
         _disposed = true;
     }
 }
Esempio n. 2
0
        public HotKey(Action action)
        {
            _action = action;

            var virtualKeyCode = KeyInterop.VirtualKeyFromKey(Key.Space);

            _id = virtualKeyCode + 65536;

            var result = Win32.RegisterHotKey(IntPtr.Zero, _id, 0x0001, (uint)virtualKeyCode);

            if (!result)
            {
                throw new InvalidOperationException("Could not register hotkey.");
            }

            if (_lookup == null)
            {
                _lookup = new Dictionary <int, HotKey>();
                ComponentDispatcher.ThreadFilterMessage += OnThreadFilterMessage;
            }
            _lookup.Add(_id, this);
        }
Esempio n. 3
0
 public bool IsWindowsShuttingDown()
 {
     return(Win32.GetSystemMetrics(Win32.W32SystemMetric.ShuttingDown) != 0);
 }