What is the best way to detect user inactivity in a Silverlight application?

Does anyone know of an effective way to detect user inactivity in a Silverlight application. The idea is that every time the user interacts with the application in any way, the timer restarts. After this period the "continue work .." dialog will be displayed for a certain period of time, and the page will be redirected to / Exit.

Massaging detects inaction. Thoughts?

+6
silverlight user-inactivity
source share
1 answer

You may need to save a DispatcherTimer with an elapsed time of 100 ms (or more) and save the user's activity time (DateTime.Now from the RootWindow PreviewMouseDown level) and continue to check this in DispatcherTimer for your predetermined inactivity time.

Update. Since PreviewEvents are not in Silverlight, you need to write your own logic around your application’s input system in your own way. But WPF has previewEvents, so it will be easier to control activity in WPF than silverlight.

+2
source share

All Articles