public static void StopScreenCapturer() { Stopwatch stp = Stopwatch.StartNew(); while (ScreenCapturer.IsActive) { ScreenCapturer.StopCapture(); System.Threading.Thread.Sleep(50); if (stp.ElapsedMilliseconds > 500) break; } }