Search code examples
c#detect

How to detect my application is idle in c# (form covered)?


I have this problem today, i saw this solution:

How to detect my application is idle in c#?

I tried that, but my form is covered with userControls and other elements, and the mouseover or keydown events are only fired in the margins of those elements.

Is there a better way?


Solution

  • Hacking together a solution with timers and mouse events is unnecessary. Just handle the Application.Idle event.

    Application.Idle += Application_Idle;
    
    private void Application_Idle(object sender, EventArgs e)
    {
        //    The application is now idle.
    }