问题
I want to know how to detect user idle in UWP. I mean not the case user idle for the app, but for the whole system/OS: no keyboard input, no mouse operation, no touch even when no focus on the app or app is minimized.
I find some other post about it. Like this: How to check if user is idle on UWP? And it uses below method:
Window.Current.CoreWindow.PointerMoved += onCoreWindowPointerMoved;
I tested and found that if my mouse moves outside of the app window, then onCoreWindowPointerMoved() will not be executed. It means this method can not detect user idle on the whole system.
回答1:
How to detect user idle in UWP?
For security reason, we could not implement this in UWP platform, But we could implement this in legacy win32 app, and use FullTrustProcessLauncher
to run the win32 app to detect the system idle. then use AppService
pass the status to UWP app. For more please refer this tutorial
来源:https://stackoverflow.com/questions/58687035/how-to-detect-user-idle-in-uwp