private void DetectPointCompleted(SpotInspectionResult res, object userToken)
 {
     res.Id = userToken as string;
     if (_sn == res.Id)
     {
         _dataAcquisition.MonitorDataReader.DetectPointCompletedEvent -= DetectPointCompleted;
         _dataAcquisition.SendData("SpotInspectionResult", CommandTextParser.GetJsonSerialization<SpotInspectionResult>(res));
     }
 }
        public void DetectPoint(string comName, ILEDDisplayInfo ledDisplayInfo, DetectConfigParams detectParams, object usertoken)
        {
            lock (detectPointObj)
            {
                if (_serverProxy == null)
                {
                    _detectPointRes = new SpotInspectionResult();
                    _detectPointRes.Result = false;
                    if (DetectPointCompletedEvent != null)
                        DetectPointCompletedEvent(_detectPointRes, usertoken);
                    return;
                }
                var _detectPointPerformer = new DetectPointPerformer(AppDataConfig.RAMTable_PATH, usertoken as string);
                _detectPointPerformer.CompletedDetectOneScanBdEvent += detectPointPerformer_CompletedDetectOneScanBdEvent;
                _detectPointPerformer.CompletedDetectAllScanBdEvent += detectPointPerformer_CompletedDetectAllScanBdEvent;
                _detectPointPerformer.ServerProxy = _serverProxy;
                _detectPointPerformer.SelectedPortName = comName;

                _detectPointUserToken = usertoken;
                _detectPointRes = new SpotInspectionResult();
                _detectPointRes.Result = true;
                if (_spotInspectionReusltTable.ContainsKey(usertoken as string))
                {
                    _spotInspectionReusltTable[usertoken as string] = _detectPointRes;
                }
                else
                {
                    _spotInspectionReusltTable.Add(usertoken as string, _detectPointRes);
                }
                DetectConfigParams tmpDetect = null;
                if (ledDisplayInfo.VirtualMode == VirtualModeType.Led4Mode1 || ledDisplayInfo.VirtualMode == VirtualModeType.Led4Mode2) tmpDetect = new DetectConfigParams(detectParams.DriverChipType, true, detectParams.ThresholdGrade, detectParams.DetectType, detectParams.IsUseCurrentGain, detectParams.RedGain, detectParams.GreenGain, detectParams.BlueGain, detectParams.VRedGain);
                else tmpDetect = new DetectConfigParams(detectParams.DriverChipType, false, detectParams.ThresholdGrade, detectParams.DetectType, detectParams.IsUseCurrentGain, detectParams.RedGain, detectParams.GreenGain, detectParams.BlueGain, detectParams.VRedGain);
                DetectPointError res = _detectPointPerformer.DetectPoint(ledDisplayInfo, tmpDetect);
                if (res != DetectPointError.OK)
                {
                    _detectPointRes = new SpotInspectionResult();
                    _detectPointRes.Id = usertoken as string;
                    _detectPointRes.Result = false;
                    if (DetectPointCompletedEvent != null)
                        DetectPointCompletedEvent(_detectPointRes, usertoken);
                }
            }
        }
 private void DetectPointCompleted(SpotInspectionResult res, object userToken)
 {
     res.Id = userToken as string;
     SendData("SpotInspectionResult", CommandTextParser.GetJsonSerialization<SpotInspectionResult>(res));
 }