I found this code:
private void PollPixel(Point location, Color color)
{
while(true)
{
var c = GetColorAt(location);
if (c.R == color.R && c.G == color.G && c.B == color.B)
{
DoAction();
return;
}
}
}
But I don't want that return();
, I want it to work until I close the program. If I remove that return the program won't work. It will start an infinte loop. I want this program to pay attention to a pixel, then if it changes its color, DoAction
will activate a macro. Then it will start paying attention again. How could I do it?