private void DisconnectDevice() { if (vsDevice != null) { if (vsDevice.IsAnyInspectionRunning) { vsDevice.StopAll(); } if (vsDevice.IsConnected) { vsDevice.Disconnect(); } } vsDevice = null; _cameraName = null; if (ConnectionEventCallback != null) { ConnectionEventCallback.Invoke(Enum_ConnectionEvent.DISCONNECTED_DEVICE, null); } }
private void Microscan_App_Closing(object sender, System.ComponentModel.CancelEventArgs e) { // Stop all inspections if (m_Dev != null) { m_Dev.StopAll(); } // Disconnect the reports if (m_RepCon1 != null) { m_RepCon1.Disconnect(); } m_RepCon1 = null; // Disconnect the IO if (m_IO != null) { m_IO.Disconnect(); } m_IO = null; // Disconnect from the camera if (m_Dev != null) { m_Dev.Disconnect(); } m_Dev = null; // Set the RootStep of setup manager to null SetupManager1.RootStep = null; // Clear the job from pc memory while (m_Job.Count > 0) { m_Job.Remove(1); } m_Job = null; }