| | |
| | | if (e.Bitmap == null) |
| | | return; |
| | | |
| | | lock (e.Bitmap) |
| | | { |
| | | if (this.InvokeRequired) // 检查是否需要在UI线程上调用 |
| | | lock (e.Bitmap) |
| | | { |
| | | this.Invoke(new Action(() => |
| | | if (this.InvokeRequired) // 检查是否需要在UI线程上调用 |
| | | { |
| | | this.Invoke(new Action(() => |
| | | { |
| | | onlinePictureBox.Image = e.Bitmap; |
| | | })); // 递归调用自身,但这次在UI线程上 |
| | | } |
| | | else |
| | | { |
| | | onlinePictureBox.Image = e.Bitmap; |
| | | })); // 递归调用自身,但这次在UI线程上 |
| | | } |
| | | } |
| | | else |
| | | { |
| | | onlinePictureBox.Image = e.Bitmap; |
| | | } |
| | | } |
| | | |
| | | total.iImageCount++; |
| | | try |
| | | { |
| | |
| | | Task.Factory.StartNew(() => |
| | | { |
| | | camera.StopGrabbing(); |
| | | camera.SetTriggerMode(TriggerMode.On, TriggerSource.Software); |
| | | camera.StartGrabbing(); |
| | | if (brand != CameraBrand.LBCamera) |
| | | { |
| | | camera.SetTriggerMode(TriggerMode.On, TriggerSource.Software); |
| | | camera.StartGrabbing(); |
| | | } |
| | | }); |
| | | } |
| | | |