private void CaptureWithoutCursor(int interval) { var sw = new Stopwatch(); while (_captureToken != null && !_captureToken.IsCancellationRequested) { sw.Restart(); //Capture frame. var frame = new FrameInfo(RecordClicked, KeyList); KeyList.Clear(); var frameCount = Capture.Capture(frame); Dispatcher.Invoke(() => FrameCount = frameCount); //If behind wait time, wait before capturing new frame. if (sw.ElapsedMilliseconds >= interval) { continue; } while (sw.Elapsed.TotalMilliseconds < interval) { Thread.Sleep(1); } //SpinWait.SpinUntil(() => sw.ElapsedMilliseconds >= interval); } sw.Stop(); }
private void Normal_Elapsed(object sender, EventArgs e) { FrameCount = _capture.Capture(new FrameInfo(false, _keyList)); _keyList.Clear(); }