private bool ConfirmCalibration() { var bChecked = new bool[3]; var rects = new rect[3]; long lStop = 0; int y = Core.Screen.Height / 2 - (_cc.ConfirmationBoxSize + _cc.Font.Height); int x = Core.Screen.Width / 2 - (_cc.ConfirmationBoxSize * 3 + _cc.ConfirmationBoxSpacing * 2) / 2; const long l100Ms = TimeSpan.TicksPerMillisecond * 100; string confLeft; string confRight; int i = _cc.ConfirmationText.IndexOf("[SECONDS]"); if (i == 0) { confLeft = _cc.ConfirmationText; confRight = string.Empty; } else { confLeft = _cc.ConfirmationText.Substring(0, i); confRight = _cc.ConfirmationText.Substring(i + 9); } rects[0] = new rect(x, y, _cc.ConfirmationBoxSize, _cc.ConfirmationBoxSize); rects[1] = new rect(x + _cc.ConfirmationBoxSize + _cc.ConfirmationBoxSpacing, y, _cc.ConfirmationBoxSize, _cc.ConfirmationBoxSize); rects[2] = new rect(rects[1].X + _cc.ConfirmationBoxSize + _cc.ConfirmationBoxSpacing, y, _cc.ConfirmationBoxSize, _cc.ConfirmationBoxSize); while (true) { string s; if (lStop == 0) { Core.Screen.SetClippingRectangle(0, 0, Core.Screen.Width, Core.Screen.Height); Core.Screen.DrawRectangle(0, 0, 0, 0, Width, Height, 0, 0, _cc.BackgroundGradientTop, 0, 0, _cc.BackgroundGradientBottom, 0, Height, 256); // Draw Check boxes DrawCheckbox(rects[0].X, rects[0].Y, false); DrawCheckbox(rects[1].X, rects[1].Y, false); DrawCheckbox(rects[2].X, rects[2].Y, false); // Draw Text if (confRight == string.Empty) { s = confLeft; } else { s = confLeft + _cc.ConfirmationTimeout + confRight; } Core.Screen.DrawTextInRect(s, 0, y + 21, Core.Screen.Width, _cc.Font.Height * 2, Bitmap.DT_AlignmentCenter, _cc.ForeColor, _cc.Font); Core.Screen.Flush(); lStop = DateTime.Now.Ticks + (TimeSpan.TicksPerSecond * _cc.ConfirmationTimeout); } else if (lStop < DateTime.Now.Ticks) { return(false); } // Get Touch Down point p = Core.ManualTouchPoint(DateTime.Now.Ticks + l100Ms).location; for (i = 0; i < 3; i++) { if (rects[i].Contains(p)) { bChecked[i] = true; break; } } float remain = (float)(lStop - DateTime.Now.Ticks) / TimeSpan.TicksPerSecond; // Refresh Screen Core.Screen.DrawRectangle(0, 0, 0, 0, Width, Height, 0, 0, _cc.BackgroundGradientTop, 0, 0, _cc.BackgroundGradientBottom, 0, Height, 256); DrawCheckbox(rects[0].X, rects[0].Y, bChecked[0]); DrawCheckbox(rects[1].X, rects[1].Y, bChecked[1]); DrawCheckbox(rects[2].X, rects[2].Y, bChecked[2]); if (confRight == string.Empty) { s = confLeft; } else { s = confLeft + System.Math.Round(remain) + confRight; } Core.Screen.DrawTextInRect(s, 0, y + 21, Core.Screen.Width, _cc.Font.Height * 2, Bitmap.DT_AlignmentCenter, _cc.ForeColor, _cc.Font); Core.Screen.Flush(); if (bChecked[0] && bChecked[1] && bChecked[2]) { Thread.Sleep(100); return(true); } } }