Esempio n. 1
0
        public override void Close()
        {
            try
            {
                IsLink = false;
                // Reset the stopwatch.
                //stopWatch.Reset();
                if (g_camera != null)
                {
                    // Stop the grabbing.
                    g_camera.StreamGrabber.Stop();
                    // Close the connection to the camera device.
                    g_camera.Close();
                    g_camera.Dispose();
                    g_camera = null;
                }

                if (m_latestFrameAddress != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(m_latestFrameAddress);
                    m_latestFrameAddress = IntPtr.Zero;
                }
            }
            catch (Exception ex)
            {/*
              * Util.WriteLog(this.GetType(), ex);
              * Util.Notify("相机关闭异常");*/
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 关闭相机,停止抓取相机并断开相机连接
        /// </summary>
        public override bool CloseCamera()
        {
            try
            {
#if (SDK)
                if (g_BaseParCamera.BlUsingTrigger)
                {
                    //关闭软触发
                }
                if (g_Camera != null && g_Camera.IsOpen && g_Camera.StreamGrabber.IsGrabbing)
                {
                    g_Camera.StreamGrabber.Stop();
                    g_Camera.Close();
                    g_Camera.Dispose();
                    g_Camera = null;
                }
#endif
                return(true);
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
                return(false);
            }
        }
Esempio n. 3
0
 public override void Close()
 {
     try
     {
         objDev.Close();
         objDev.Dispose();
         if (latestFrameAddress != null)
         {
             Marshal.FreeHGlobal(latestFrameAddress);
             latestFrameAddress = IntPtr.Zero;
         }
     }
     catch (Exception e)
     {
         ShowException(e);
     }
 }
Esempio n. 4
0
 public override bool CloseCamera()
 {
     camera1.StreamGrabber.Stop();
     camera1.Close();
     camera1.Dispose();
     camera1 = null;
     return(true);
 }
Esempio n. 5
0
 public bool CloseCamera()
 {
     if (camera.IsOpen == true)
     {
         camera.Close();
         LOG("camera closed");
         return(true);
     }
     return(false);
 }
Esempio n. 6
0
 public override void CloseCamera()
 {
     lock (m_lock)
     {
         if (camera != null)
         {
             camera.Close();
         }
     }
 }
Esempio n. 7
0
 public short Close()
 {
     if (camera == null)
     {
         return(-1);
     }
     else
     {
         camera.Close();
         camera.Dispose();
         camera = null;
         return(0);
     }
 }
Esempio n. 8
0
 public override bool Close()
 {
     if (null != _aca500M_Camera)
     {
         if (_aca500M_Camera.StreamGrabber.IsGrabbing)
         {
             _aca500M_Camera.StreamGrabber.Stop();
         }
         if (_aca500M_Camera.IsOpen)
         {
             _aca500M_Camera.Close();
         }
     }
     bInitOk = false;
     return(bInitOk);
 }
Esempio n. 9
0
        private void btnSearchCamera_Click(object sender, EventArgs e)//枚举相机
        {
            cameraInfo = BP.CameraFinder.Enumerate();

            if (cameraInfo == null)
            {
                MessageBox.Show("Can not find any camera");
                return;
            }
            int       i            = 0;
            DataTable dtCameraInfo = new DataTable();

            dtCameraInfo.Columns.Add(new DataColumn("name"));
            dtCameraInfo.Columns.Add(new DataColumn("value"));

            foreach (var item in cameraInfo)
            {
                DataRow   row     = dtCameraInfo.NewRow();
                BP.Camera myCmera = new BP.Camera(item);
                try
                {
                    myCmera.Open();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                String strSerialNum = myCmera.Parameters[BP.PLCamera.DeviceID].GetValue();


                String strCameraInfo = String.Format("Camera{0}:serialNumber:{1}", i, strSerialNum);

                row["name"]  = strCameraInfo;
                row["value"] = strSerialNum;
                myCmera.Close();
                dtCameraInfo.Rows.Add(row);
            }
            cmbCamera.DisplayMember = "name";
            cmbCamera.ValueMember   = "value";

            cmbCamera.DataSource = dtCameraInfo;
        }
Esempio n. 10
0
        /// <summary>
        /// 关闭相机
        /// </summary>
        /// <returns></returns>
        public override bool DoClose()
        {
            bool rt = false;

            try
            {
                if (_device != null)
                {
                    SetFreeRun();
                    _device.Close();
                    _device.Dispose();
                    rt = true;
                }
                else
                {
                    if (DriverExceptionDel != null)
                    {
                        DriverExceptionDel(string.Format("错误:巴斯勒相机关闭失败!\n:{0}",
                                                         "设备未连接"));
                    }
                }
            }
            catch (System.Exception ex)
            {
                if (DriverExceptionDel != null)
                {
                    DriverExceptionDel(string.Format("错误:巴斯勒相机关闭失败!\n错误描述:{0}",
                                                     ex.Message));
                }
            }
            finally
            {
            }

            return(rt);
        }
Esempio n. 11
0
 public void Close()
 {
     camera.Close();
     RaisePropertyChanged("IsOpen");
 }
Esempio n. 12
0
 public void stop()
 {
     camera.StreamGrabber.Stop();
     camera.Close();
 }
 public override void Close()
 {
     camera.Close();
 }