I want to be able to prevent the screen saver from triggering while my app is in use by using the DisplayRequest class, but I only want to do this while it\'s the active app
I use the visibility changed event on the home window. The event is not fired when opening or closing a new window within the app.
Window.Current.VisibilityChanged += OnVisibilityChanged;
///
/// When the window visibility changes, the stuff happens
///
/// object sender
/// VisibilityChangedEventArgs e
private void OnVisibilityChanged(object sender, VisibilityChangedEventArgs e)
{
if (!e.Visible)
{
// do stuff
}
else
{
// do other stuff
}
}