Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
            /*** 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;
            }
Exemplo n.º 3
0
            public void Dispose()
            {
                if (_messageWindow != null)
                {
                    _messageWindow.Dispose();
                    _messageWindow = null;
                }

                if (_appInfo != null)
                {
                    _appInfo.Dispose();
                    _appInfo = null;
                }
            }