private static void Current_Exit(object sender, ExitEventArgs e)
 {
     Application.Current.Exit -= Current_Exit;
     if (_windowHandler == null)
     {
         return;
     }
     _windowHandler.FocusChanged -= WindowFocusChanging;
     //_windowHandler.Activate -= new EventHandler<WindowActivateEventArgs>(WindowActivating);
     _windowHandler.Detach();
     _windowHandler = null;
 }
        internal static void FinalizeFocusManagement(DockingManager manager)
        {
            manager.PreviewGotKeyboardFocus -= manager_PreviewGotKeyboardFocus;
            Managers.Remove(manager);

            if (Managers.Count != 0)
                return;
            //InputManager.Current.EnterMenuMode -= new EventHandler(InputManager_EnterMenuMode);
            //InputManager.Current.LeaveMenuMode -= new EventHandler(InputManager_LeaveMenuMode);
            if (_windowHandler == null)
                return;
            _windowHandler.FocusChanged -= WindowFocusChanging;
            //_windowHandler.Activate -= new EventHandler<WindowActivateEventArgs>(WindowActivating);
            _windowHandler.Detach();
            _windowHandler = null;
        }
        internal static void FinalizeFocusManagement(DockingManager manager)
        {
            manager.PreviewGotKeyboardFocus -= manager_PreviewGotKeyboardFocus;
            Managers.Remove(manager);

            if (Managers.Count != 0)
            {
                return;
            }
            //InputManager.Current.EnterMenuMode -= new EventHandler(InputManager_EnterMenuMode);
            //InputManager.Current.LeaveMenuMode -= new EventHandler(InputManager_LeaveMenuMode);
            if (_windowHandler == null)
            {
                return;
            }
            _windowHandler.FocusChanged -= WindowFocusChanging;
            //_windowHandler.Activate -= new EventHandler<WindowActivateEventArgs>(WindowActivating);
            _windowHandler.Detach();
            _windowHandler = null;
        }
        internal static void SetupFocusManagement(DockingManager manager)
        {
            if (Managers.Count == 0)
            {
                //InputManager.Current.EnterMenuMode += new EventHandler(InputManager_EnterMenuMode);
                //InputManager.Current.LeaveMenuMode += new EventHandler(InputManager_LeaveMenuMode);
                _windowHandler = new WindowHookHandler();
                _windowHandler.FocusChanged += WindowFocusChanging;
                //_windowHandler.Activate += new EventHandler<WindowActivateEventArgs>(WindowActivating);
                _windowHandler.Attach();

                if (Application.Current != null)
                {
                    Application.Current.Exit += Current_Exit;
                }
            }

            manager.PreviewGotKeyboardFocus += manager_PreviewGotKeyboardFocus;
            Managers.Add(manager);
        }
 private static void Current_Exit(object sender, ExitEventArgs e)
 {
     Application.Current.Exit -= Current_Exit;
     if (_windowHandler == null)
         return;
     _windowHandler.FocusChanged -= WindowFocusChanging;
     //_windowHandler.Activate -= new EventHandler<WindowActivateEventArgs>(WindowActivating);
     _windowHandler.Detach();
     _windowHandler = null;
 }
        internal static void SetupFocusManagement(DockingManager manager)
        {
            if (Managers.Count == 0)
            {
                //InputManager.Current.EnterMenuMode += new EventHandler(InputManager_EnterMenuMode);
                //InputManager.Current.LeaveMenuMode += new EventHandler(InputManager_LeaveMenuMode);
                _windowHandler = new WindowHookHandler();
                _windowHandler.FocusChanged += WindowFocusChanging;
                //_windowHandler.Activate += new EventHandler<WindowActivateEventArgs>(WindowActivating);
                _windowHandler.Attach();

                if (Application.Current != null)
                    Application.Current.Exit += Current_Exit;
            }

            manager.PreviewGotKeyboardFocus += manager_PreviewGotKeyboardFocus;
            Managers.Add(manager);
        }