How to implement security timeout in C# Forms project?
Posted on 2009-07-10
I am implementing the security portion of a project that has a requirement for a password screen to get into the Security mode, as well as a requirement for that password prompt to activate after a timeout period. So once the user passes the login screen, I have to start timing for inactivity, and reset the timer as soon as there is any interaction at all with the app. If the timer reaches a certain point (say, a minute), I need to pop up the password dialog again.
My first thought is that I'll have to have event handlers in everything that can be acted upon, and then reset the timer when those events are fired. However, this seems like an inelegant solution that will be costly to maintain. Is there an easy way to catch click and keystroke events all in one place, and not in individual forms? Has anyone done anything like this before? Any suggestions will be appreciated. If it helps to know, I am using SmartParts and the CAB, as well as Infragistics 9.1 with a ribbon tool.