public void DownloadJob() { if (vsDevice == null || jobStep == null) { return; } if (vsDevice.IsAnyInspectionRunning) { vsDevice.StopAll(); } if (vsDevice.DeviceClass == tagDEVCLASS.DEVCLASS_GIGE_VISION_SYSTEM || vsDevice.DeviceClass == tagDEVCLASS.DEVCLASS_SOFTWARE_EMULATED) { if (ConnectionEventCallback != null) { vsDevice.Download(jobStep, true); Event_Progress ep = new Event_Progress(); ep.progress = 1; ep.message = "Download Completed"; vsDevice.StartAll(); ConnectionEventCallback.Invoke(Enum_ConnectionEvent.DOWNLOADED_JOB, ep); } } else { try { _downloadProgress = 0; vsDevice.OnXferProgress += vsDevice_OnXferProgress; vsDevice.OnDownloadComplete += vsDevice_OnDownloadComplete; vsDevice.Download(jobStep, false); } catch (Exception e) { if (ConnectionEventCallback != null) { ConnectionEventCallback.Invoke(Enum_ConnectionEvent.ERROR, e.Message); } } } }
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; }