|
@@ -378,30 +378,29 @@ namespace ImpulseVision
|
|
|
|
|
|
private void CmbCams_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
- //try
|
|
|
- //{
|
|
|
- // //если захват видео уже идёт
|
|
|
- // if (Capture != null)
|
|
|
- // {
|
|
|
- // //captureTimer.Stop();
|
|
|
- // Capture.Dispose();
|
|
|
- // Capture = null;
|
|
|
- // PbxEther.Image = null;
|
|
|
- // }
|
|
|
- //}
|
|
|
- //catch (Exception ex)
|
|
|
- //{
|
|
|
- // MessageBox.Show(ex.Message, "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
|
- //}
|
|
|
-
|
|
|
- //SelectedCameraID = CmbCams.SelectedIndex;
|
|
|
-
|
|
|
- //Capture = new VideoCapture(SelectedCameraID);
|
|
|
- ////настройка кадров
|
|
|
- //Capture.SetCaptureProperty(CapProp.Fps, 30);
|
|
|
- //Capture.SetCaptureProperty(CapProp.FrameHeight, 450);
|
|
|
- //Capture.SetCaptureProperty(CapProp.FrameWidth, 370);
|
|
|
- //CaptureTimer.Start();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (BgrFrame != null)
|
|
|
+ {
|
|
|
+ BgrFrame = null;
|
|
|
+ Capture.Dispose();
|
|
|
+ CaptureTimer.Tick -= CaptureTimer_Tick;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ MessageBox.Show(ex.Message, "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
|
+ }
|
|
|
+
|
|
|
+ SelectedCameraID = CmbCams.SelectedIndex;
|
|
|
+
|
|
|
+ Capture = new VideoCapture(SelectedCameraID);
|
|
|
+ //настройка кадров
|
|
|
+ Capture.SetCaptureProperty(CapProp.Fps, 30);
|
|
|
+ Capture.SetCaptureProperty(CapProp.FrameHeight, 450);
|
|
|
+ Capture.SetCaptureProperty(CapProp.FrameWidth, 370);
|
|
|
+ CaptureTimer.Tick += CaptureTimer_Tick;
|
|
|
+ CaptureTimer.Start();
|
|
|
}
|
|
|
|
|
|
private void TimerCam_Tick(object sender, EventArgs e)
|
|
@@ -430,14 +429,12 @@ namespace ImpulseVision
|
|
|
if (BgrFrame != null)
|
|
|
{
|
|
|
BgrFrame = null;
|
|
|
- //Capture.Stop();
|
|
|
- //Capture.Dispose();
|
|
|
Capture.Dispose();
|
|
|
+ CaptureTimer.Tick -= CaptureTimer_Tick;
|
|
|
}
|
|
|
- //CaptureTimer.Stop();
|
|
|
- CaptureTimer.Tick -= CaptureTimer_Tick;
|
|
|
|
|
|
PbxEther.Image = Properties.Resources._9110852_video_no_icon;
|
|
|
+ CaptureTimer.Tick -= CaptureTimer_Tick;
|
|
|
}
|
|
|
private void DgbOutput_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
|
|
{
|