Exemplo n.º 1
0
        private void btn_CameraSwitch_Click(object sender, EventArgs e)
        {
            HDevWindowStack.Push(hv_WindowHandle);
            if (m_Grabber_1 != IntPtr.Zero || m_Grabber_2 != IntPtr.Zero)
            {
                if (CameraSwitch)
                {
                    label_CameraNo.Text = "2";
                    if (m_Grabber_1 != IntPtr.Zero)
                    {
                        MvApi.CameraGrabber_StopLive(m_Grabber_1);
                    }

                    if (m_Grabber_2 != IntPtr.Zero)
                    {
                        MvApi.CameraGrabber_StartLive(m_Grabber_2);
                    }
                    CameraSwitch = false;
                }
                else
                {
                    label_CameraNo.Text = "1";
                    if (m_Grabber_2 != IntPtr.Zero)
                    {
                        MvApi.CameraGrabber_StopLive(m_Grabber_2);
                    }

                    if (m_Grabber_1 != IntPtr.Zero)
                    {
                        MvApi.CameraGrabber_StartLive(m_Grabber_1);
                    }
                    CameraSwitch = true;
                }
            }
        }
Exemplo n.º 2
0
 private void btn_GrabPhoto_Click(object sender, EventArgs e)
 {
     if (m_Grabber != IntPtr.Zero)
     {
         MvApi.CameraGrabber_StopLive(m_Grabber);
     }
 }
Exemplo n.º 3
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (m_Grabber_1 != IntPtr.Zero)
     {
         MvApi.CameraGrabber_StopLive(m_Grabber_1);
     }
     if (m_Grabber_2 != IntPtr.Zero)
     {
         MvApi.CameraGrabber_StopLive(m_Grabber_2);
     }
 }
Exemplo n.º 4
0
 private void btn_TwoCameras_Snap_Click(object sender, EventArgs e)
 {
     HDevWindowStack.Push(hv_WindowHandle);
     if (m_Grabber_1 != IntPtr.Zero)
     {
         MvApi.CameraGrabber_StopLive(m_Grabber_1);
     }
     if (m_Grabber_2 != IntPtr.Zero)
     {
         MvApi.CameraGrabber_StopLive(m_Grabber_2);
     }
 }
Exemplo n.º 5
0
 public void CameraStop()
 {
     if (m_Grabber != IntPtr.Zero)
     {
         MvApi.CameraGrabber_StopLive(m_Grabber);
     }
     if (t1.Status != TaskStatus.Canceled)
     {
         cts.Cancel();
         clearFlage = false;
     }
 }
        public override void Close()
        {
            try
            {
                IsLink = false;

                // Reset the stopwatch.
                //stopWatch.Reset();
                if (m_Grabber != IntPtr.Zero)
                {
                    MvApi.CameraGrabber_StopLive(m_Grabber);
                    MvApi.CameraGrabber_Destroy(m_Grabber);
                }
                m_Grabber = IntPtr.Zero;
            }
            catch (Exception ex)
            {
                //Util.WriteLog(this.GetType(), ex);
                Util.Notify("相机关闭异常");
                throw ex;  //抛给上层,上层捕获到该异常,不会执行其函数余下的代码;
            }
        }