private void OnIdle(object sender, EventArgs e) { try { bool ignore = false; if (!ignore && Visible) { DateTime now = DateTime.Now; bool expired = (now - lastImageTime).TotalMilliseconds > 10; if (expired) { ICameraProxy camera = Settings.Get <ICameraProxy>(); if (camera != null) { CurrentImage = camera.AcquireImage(); lastImageTime = now; ViewPanel.Invalidate(); } else { bool lasthasImage = CurrentImage != null; CurrentImage = null; if (lasthasImage) { ViewPanel.Invalidate(); } } ILaserProxy laser = Settings.Get <ILaserProxy>(); expired = (now - lastImageTime).TotalMilliseconds > 750; if (laser != null) { LaserControl.Proxy = laser; LaserControl.AlignControls(); } } } } catch { } }