void RealDispose() { if (_disposed) { return; } _disposed = true; _cts?.Cancel(); Application.Exit(); _task?.Wait(); _task?.Dispose(); if (_window != null) { if (_registry != null) { foreach (var info in _registry) { User32.UnregisterHotKey(_window.Handle, info.Id); } } _window.Dispose(); } }
/*** IDisposable impl ***/ void IDisposable.Dispose() { if (_disposed) { return; } // Attempt to unregister all of our hotkeys foreach (var hk in _hotkeys) { if (!UnregisterHotKey(_msgWindow.Handle, hk.Key)) { throw Helpers.LastWin32Exception(); } } _hotkeys.Clear(); _msgWindow.Dispose(); // Next call to [Retrieve] will create a new registrar. _singleton = null; _disposed = true; }
public void Dispose() { if (_messageWindow != null) { _messageWindow.Dispose(); _messageWindow = null; } if (_appInfo != null) { _appInfo.Dispose(); _appInfo = null; } }