private void vsDevice_OnXferProgress(int nState, int nStatus, string msg) { /* * Download Started to VisionHawk1580EB * FTP Connection established * Copying files to device... * Copying _visionhawkcm_4002_752x480_CMOS.cam... * Job streamed to memory * RAM Drive Created * Avp downloaded to Device * Loading job on device... * Job Loaded * Download Complete to VisionHawk1580EB */ _downloadProgress += 0.1; if (ConnectionEventCallback != null) { Event_Progress ep = new Event_Progress(); ep.progress = _downloadProgress; ep.message = msg; ConnectionEventCallback.Invoke(Enum_ConnectionEvent.DOWNLOADING_JOB, ep); } }
private void vsDevice_OnDownloadComplete(int nStatus) { if (!vsDevice.IsInspectionRunning()) { vsDevice.StartAll(); } if (ConnectionEventCallback != null) { Event_Progress ep = new Event_Progress(); ep.progress = 1; ep.message = "Download Completed"; ConnectionEventCallback.Invoke(Enum_ConnectionEvent.DOWNLOADED_JOB, ep); } vsDevice.OnXferProgress -= vsDevice_OnXferProgress; vsDevice.OnDownloadComplete -= vsDevice_OnDownloadComplete; }
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); } } } }