I was looking for the best approach to find out the if my users are idle in my WPF application. Currently, I take this idle time from operating system, and if they minimize the application, and go and search in Internet, there is a process in the operating system, so Operation system does not consider this as inactivity time even though they are not doing anything inside the application. However, I would like to find out if they have not clicked or do anything inside my application.
This is how I can that idle time right now.
myApplication.MainMethod()
{
System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer();
myTimer .Interval = 1000;
myTimer .Tick += new EventHandler(Timer_Tick);
myTimer .Start();
}
void Timer_Tick(object sender, EventArgs e)
{
int idleTime= (int)Win32.GetIdleTime();
if (idleTime<certainNumber)
{
//do this
}
}