void RegisterEventHandlersForWindow(AppWindow window)
        {
            //Set up the activation handler
            InputActivationListener activationListener = InputActivationListenerPreview.CreateForApplicationWindow(window);

            activationListener.InputActivationChanged += ActivationListener_InputActivationChanged;

            // Make sure we release the reference to this window, and release XAML resources, when it's closed
            appWindow.Closed += delegate { appWindow = null; appWindowFrame.Content = null; };
        }
        private void ActivationListener_InputActivationChanged(InputActivationListener sender, InputActivationListenerActivationChangedEventArgs args)
        {
            // Dummy method for now just to show the outline.
            // This sample has no content that needs modification due to activation state.
            // We are entirely relying on XAML to do the right thing for our simple app. :)
            switch (args.State)
            {
            case InputActivationState.ActivatedInForeground:
                // The user will be interacting with this window, so make sure the full user experience is running
                break;

            case InputActivationState.ActivatedNotForeground:
                // The window is showing, but the user is interacting with another window, adjust accordingly
                break;

            case InputActivationState.Deactivated:
                // The user moved on, they have switched to another window, time to go back to inactive state.
                break;

            default:
                break;
            }
        }
Example #3
0
 private void AppWindow_InputActivationChanged(InputActivationListener sender, InputActivationListenerActivationChangedEventArgs args)
 {
     _windowActivated = args.State != InputActivationState.Deactivated;
     UpdateBrush();
 }