Example #1
0
        public void Release(bool activateWindowIfNeeded)
        {
            if (Container == null)
            {
                return;
            }

            Container.Initialized -= OnOwnerInitialized;
            var container = Container;

            Container = null;
            if (lockMode == SplashScreenLock.None)
            {
                return;
            }

            SplashScreenHelper.InvokeAsync(container, () => {
                bool activateWindow = activateWindowIfNeeded && !SplashScreenHelper.ApplicationHasActiveWindow();
                UnlockContainer(container);
                if (activateWindow)
                {
                    container.ActivateWindow();
                }
                else if (Keyboard.FocusedElement == null)
                {
                    SplashScreenHelper.GetApplicationActiveWindow(false).Do(x => x.Focus());
                }
            }, DispatcherPriority.Render);
        }
Example #2
0
 void ActivateWindowCore()
 {
     if (Window != null && !Window.IsActive && Window.IsVisible && !SplashScreenHelper.ApplicationHasActiveWindow())
     {
         Window.Activate();
     }
 }
        public void Release(bool activateWindowIfNeeded)
        {
            if (Container == null)
            {
                return;
            }

            Container.Initialized -= OnOwnerInitialized;
            var container = Container;

            Container = null;
            if (container.Window == null || lockMode == SplashScreenLock.None)
            {
                return;
            }

            SplashScreenHelper.InvokeAsync(container.Window, () => {
                if (activateWindowIfNeeded && !SplashScreenHelper.ApplicationHasActiveWindow())
                {
                    container.ActivateWindow();
                }

                SplashScreenHelper.UnlockWindow(container);
            }, DispatcherPriority.Render);
        }