Code: Select all
...
Report.Log(ReportLevel.Info, "Wait", "Looking for 'CTRL-ALT-DEL' image.");
if (! ImageFound(@"CtrlAltDel.png", 10000))
throw new ValidationException("Fail to find image.");
...
private bool ImageFound(String ImageFile, int Wait)
{
const long TicksPerMsec = 10000;
Bitmap Bmp = Imaging.Load(@"..\..\Images\" + ImageFile);
long Timeout = System.DateTime.Now.Ticks + (Wait * TicksPerMsec);
bool ImgFound = false;
while (System.DateTime.Now.Ticks < Timeout && ! ImgFound) {
ImgFound = Imaging.Contains(MyRepo.FormConsole.Self, Bmp);
Delay.Milliseconds(100);
}
return ImgFound;
}