UWP idle detection

I would like to know when a user is idle for an action, so I decided that joining the event PointerMovedin mine would be a good start Page. Each time the mouse cursor moves, the counter is reset.

The problem is that mine Pagecontains a control WebViewthat displays the website. It covers almost the entire part of the screen. I noticed that when I move the mouse cursor, the event PointerMoveddoes not occur when it is over WebView.

But this is even worse: this happens when I add a handler to myWebView.PointerMoved. It does not cause any event!

Maybe I'm doing it wrong. What can I do to determine when the user is idle? Am I using the wrong method?

+4
source share
1 answer

I just tried this even through the CoreWindow object and the PointerMoved event, but even the one that does not start with the webview.

Perhaps a background task with a single processor model could allow you to execute your script?

The background task model contains triggers for the user and the user:

new SystemTrigger(SystemTriggerType.UserPresent, false);
new SystemTrigger(SystemTriggerType.UserAway, false);

And with a single processor model, you can verify that your application has received a call, not a background task in other processes: https://blogs.windows.com/buildingapps/2016/06/07/background-activity-with-the- single-process-model

+1

Source: https://habr.com/ru/post/1664465/


All Articles