Example #1
0
 public void UnhookWinEvents()
 {
     foreach(var hook in hWinEventHooks)
     {
         WinEventHook.WinEventUnhook(hook);
     }
     hWinEventHooks.Clear();
 }
        public override int Shutdown()
        {
            SaveConfiguration(Config);

            try
            {
                if (_windowEventGCHandle.IsAllocated)
                {
                    _windowEventGCHandle.Free();
                }

                if (_windowEventHook != IntPtr.Zero)
                {
                    WinEventHook.WinEventUnhook(_windowEventHook);
                }

                _windowEventDispatcher?.InvokeShutdown();
            }
            catch (Exception ex)
            {
                _hostDelegates.ExceptionMessage(ex);
            }

            _black?.Dispose();
            _white?.Dispose();
            _green?.Dispose();
            _lawngreen?.Dispose();
            _grey?.Dispose();
            _darkergrey?.Dispose();
            _red?.Dispose();
            _darkred?.Dispose();
            _gold?.Dispose();
            _goldenrod?.Dispose();
            _violet?.Dispose();

            _consolas14Bold?.Dispose();
            _consolas16Bold?.Dispose();
            _consolas32Bold?.Dispose();

            _characterSheet?.Dispose();
            _characterToImageTranslation = null;

            _windowEventHook       = IntPtr.Zero;
            _windowEventDispatcher = null;

            _device = null;
            _graphics?.Dispose();
            _graphics = null;
            _window?.Dispose();
            _window = null;

            _isOverlayInitialized = false;
            _isOverlayReady       = false;

            return(0);
        }
Example #3
0
        protected void DisableAttactWindow()
        {
            try
            {
                if (_windowEventGCHandle.IsAllocated)
                {
                    _windowEventGCHandle.Free();
                }

                if (_windowEventHook != IntPtr.Zero)
                {
                    WinEventHook.WinEventUnhook(_windowEventHook);
                }
            }
            catch (Exception ex)
            {
                Plugin.ShowExceptionMessage(ex);
            }
            finally
            {
                _windowEventHook = IntPtr.Zero;
            }
        }