- Add a timer control to your application.
- Subscribe to mouseover and keydown events – when they fire, reset the timer.
- When the timer fires (ie mouse hasn’t moved and key’s haven’t been pressed for x amount of time), lock the screen / prompt for login.
This could also help: http://www.codeproject.com/Articles/13756/Detecting-Application-Idleness
solved How to check if the mouse did not move for 2 minutes in WPF?