Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Does anyone know of an efficient way to detect user inactivity in a Silverlight App. The idea is that everytime a user interacts with the app in any way a timer would reload. When it expires, a "continue working.." dialog would be displays for a period and the the page would redirect to /Logout.

The rub is detecting inactivity. Thoughts?

like image 679
caryden Avatar asked Dec 23 '09 00:12

caryden


1 Answers

You may need to keep a DispatcherTimer with an elapsedtime of 100ms(Or more) and store the user activity time (DateTime.Now from a RootWindow level PreviewMouseDown) and keep checking that in the DispatcherTimer against your pre-defined inactivity time.

Update : Since PreviewEvents are not in Silverlight, you need to write your own logic around the input system of your application in your own specific way. But WPF has previewEvents so it will be easy to monitor the activity in WPF than silverlight.

like image 166
Jobi Joy Avatar answered Oct 31 '22 22:10

Jobi Joy