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. If the user switches to another window/app then I want to act like a good citizen and allow the screensaver again.
I can't see an obvious way to detect when a UWP app gets/loses focus (or is activated/deactivated) and a quick search around doesn't offer any insights. Can anyone point me in the right direction?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…