/// <summary>
        /// Stop the <see cref="SystemEventWatcher"/> and free
        /// all resources used by it.
        /// </summary>
        public void Stop()
        {
            if (null != _msgPumpThread)
            {
                _msgPumpThread.Join(500);
                if (_msgPumpThread.IsAlive)
                {
                    _msgPumpThread.Abort();
                }
                _msgPumpThread = null;
            }

            if (null != _msgPump)
            {
                _msgPump.Close();
                _msgPump.Dispose();
                _msgPump = null;
            }
        }
 public SystemEventWatcher()
 {
     _msgPump = new MessagePumpProvider();
     Application.ApplicationExit += Application_Exit;
 }