I want a simple method to check when the application is busy and when it is idle. After doing some searching I found two ways people have suggested. One us GetLastInputInfo function and other is the Application.Idle.
I just want to detect the Application inactivity not the system inactivity. So I am planning to use Application.Idle. But now how do I trigger an event when the application becomes active again? I am starting the timer in Idle event and I wish to reset that in the other function.
Any help would be appreciated.
My event handler:
void Application_Idle(object sender, EventArgs e)
{
System.Timers.Timer aTimer = new System.Timers.Timer(5000);
aTimer.Elapsed += aTimer_Elapsed;
aTimer.Enabled = true;
}