private void Worker_DoWork(object sender, DoWorkEventArgs e) { int image = 0; while (camIsGood) { if (progState == PROG_STATE.CAPTURED) { Thread.Sleep(4); continue; } FSDKCam.GrabFrame(cameraHandle, ref image); var cimg = new FSDK.CImage(image); worker.ReportProgress(0, cimg.Copy().ToCLRImage()); if (progState == PROG_STATE.CAPTURING) { var imgPath = Path.GetFullPath(Path.Combine("Captures", Guid.NewGuid().ToString() + ".jpg")); cimg.Save(imgPath); worker.ReportProgress(1, imgPath); } cimg.Dispose(); FSDK.FreeImage(image); GC.Collect(); Thread.Sleep(16); } FSDKCam.CloseVideoCamera(cameraHandle); }