private void Form1_FormClosing(object sender, FormClosingEventArgs e) { try { m_camera.Disconnect(); } catch (FC2Exception ex) { // Nothing to do here } catch (NullReferenceException ex) { // Nothing to do here } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { try { toolStripButtonStop_Click(sender, e); m_camera.Disconnect(); } catch (FC2Exception ex) { // Nothing to do here } catch (NullReferenceException ex) { // Nothing to do here } }
public void ReconnectCamera(ManagedPGRGuid guid) { lock (this) { if (m_isConnected == true) { try { if (m_camera.IsConnected()) { m_camera.Disconnect(); m_camera.Connect(guid); } else { m_camera.Connect(guid); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } } Debug.WriteLine("Reconnected to camera"); } }
public void Dispose() { if (camera.IsConnected()) { camera.StopCapture(); camera.Disconnect(); } }
private void Window_Closing(object sender, EventArgs e) { m_continue = false; try { m_Done.WaitOne(100); m_cam.StopCapture(); m_cam.Disconnect(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } finally { Application.Current.Shutdown(); } }
public bool Connect() { bool flag = false; CameraSelectionDialog camSlnDlg = new CameraSelectionDialog(); camSlnDlg.Show(); camSlnDlg.Hide(); //if (camSlnDlg.ShowModal()) { try { ManagedPGRGuid[] selectedGuids = camSlnDlg.GetSelectedCameraGuids(); ManagedPGRGuid guidToUse = selectedGuids[0]; ManagedBusManager busMgr = new ManagedBusManager(); m_camera = new ManagedCamera(); // Connect to the first selected GUID m_camera.Connect(guidToUse); m_camCtlDlg.Connect(m_camera); CameraInfo camInfo = m_camera.GetCameraInfo(); camInfo.vendorName = "MicroTest"; camInfo.modelName = "v1"; // UpdateFormCaption(camInfo); // Set embedded timestamp to on EmbeddedImageInfo embeddedInfo = m_camera.GetEmbeddedImageInfo(); embeddedInfo.timestamp.onOff = true; //embeddedInfo.exposure.onOff = true; embeddedInfo.shutter.onOff = true; //tbox_uptime.Text = embeddedInfo.timestamp.ToString(); m_camera.SetEmbeddedImageInfo(embeddedInfo); flag = true; } catch (IndexOutOfRangeException e) { m_camCtlDlg.Disconnect(); if (m_camera != null) { m_camera.Disconnect(); } flag = false; throw e; } } return(flag); }
/// <summary> /// 关闭相机,停止抓取相机并断开相机连接 /// </summary> public override bool CloseCamera() { try { #if (SDK) if (g_BaseParCamera.BlUsingTrigger) { SetSoftTrriger(false);//关闭软触发 } g_ManagedCameraBase.StopCapture(); g_ManagedCameraBase.Disconnect(); #endif return(true); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); return(false); } }
public void Disconnect() { m_camCtlDlg.Hide(); m_camCtlDlg.Disconnect(); m_camera.Disconnect(); }