public void Dispose() { if (!_disposed) { Win32.UnregisterHotKey(IntPtr.Zero, _id); _disposed = true; } }
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); }
public bool IsWindowsShuttingDown() { return(Win32.GetSystemMetrics(Win32.W32SystemMetric.ShuttingDown) != 0); }