Detect if user Idle on windows universal app

安稳与你 提交于 2019-11-26 21:24:17

问题


I'm developing a class library for windows 10 universal apps (mobile and desktop device families only). I need to invoke an event if the user has been idle(no touch, mouse move, key press etc) for x number of seconds. This method can be used to solves this problem on android. But I couldn't find a solution on windows UWP.

Is there an API available in UWP to achieve this?


回答1:


You can detect global input with various events on the app's CoreWindow:

Touch and mouse input with CoreWindow.PointerPressed, PointerMoved, and PointerReleased.

Keyboard input: KeyUp and KeyDown (the soft keys) and CharacterReceived (for characters generated via chords & text suggestions)

Use these to detect the user is active and idle out if it goes too long without any of these events.



来源:https://stackoverflow.com/questions/31114031/detect-if-user-idle-on-windows-universal-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!