Deferred action for a certain period of time

I am currently working on a screensaver launcher, but I want to postpone the activation of the screensaver for a while to ensure that the mouse is in position to activate it, to prevent accidental activation. I think some thread to check the position of the mouse on the x seconds before the execution, whether it is a reasonable solution?

I don’t write a screensaver, I wrote an application so that when you move the mouse to a certain corner of the desktop, the screensaver comes in ... I want to know how to add a delay when you move the mouse to this corner to prevent the screensaver from accidentally starting

If so, how?

+5
source share
2 answers

...

, . .
, , .

, .

+4

   var CurrentMouse = ...; // Get mouse coordinates.
   ThreadPool.QueueUserWorkItem(        
   (s) => {
            Thread.Sleep(500); // Half a second

        //  if (Mouse did not move)
        //     Launch Screen Saver

   });

EDIT: , , gui . . # MultiThreading ThreadPool, , .

0

All Articles