public DetectionThread(Detection.DetectionTemplate dtpl, int threshold, string[] FileNames, DetectionCallback caller, PresentationCallback pCall, bool saveRecognitionResult) { this.detectionTemplate = dtpl; this.threshold = threshold; this.FileNames = FileNames; this.dCall = caller; this.pCall = pCall; this.saveRecognitionResult = saveRecognitionResult; }
/// <summary> /// Begins the auto-detection. /// </summary> /// <param name="DetectionEvent">Callback function when the detection finished.</param> public void BeginDetection(DetectionCallback DetectionEvent) { DetectionDelegate detectdelegate = new DetectionDelegate(RunDetection); IAsyncResult result = detectdelegate.BeginInvoke( (r) => { var outcome = detectdelegate.EndInvoke(r); if (DetectionEvent != null) DetectionEvent(outcome); }, null); }
/// <summary> /// Begins the auto-detection. /// </summary> /// <param name="DetectionEvent">Callback function when the detection finished.</param> public void BeginDetection(DetectionCallback DetectionEvent) { detectThread = new Thread(new ThreadStart(() => { var outcome = RunDetection(); if (DetectionEvent != null) { DetectionEvent(outcome); } })); detectThread.Start(); }
/// <summary> /// Begins the auto-detection. /// </summary> /// <param name="DetectionEvent">Callback function when the detection finished.</param> public void BeginDetection(DetectionCallback DetectionEvent) { DetectionDelegate detectdelegate = new DetectionDelegate(RunDetection); IAsyncResult result = detectdelegate.BeginInvoke( (r) => { var outcome = detectdelegate.EndInvoke(r); if (DetectionEvent != null) { DetectionEvent(outcome); } }, null); }
/// <summary> /// Begins the auto-detection. /// </summary> /// <param name="DetectionEvent">Callback function when the detection finished.</param> public void StartDetection(DetectionCallback callback) { if (GetDetectionStatus() == DetectionStatus.InProgress) { return; } // attach detect log callback to update detect step status AttachDetectLogCallback(); // start detection StartDetection(); }
/// <summary> /// Start the auto-detection /// </summary> /// <param name="callback">The call back function when the detection finished.</param> public void StartDetection(DetectionCallback callback) { stepIndex = 0; detectorLog = Path.Combine(appConfig.AppDataDirectory, "Detector_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss-fff") + ".log"); logWriter = new StreamWriter(detectorLog); detector.DetectLogCallback = (msg, style) => { if (stepIndex == detectSteps.Count) { return; } var item = detectSteps[stepIndex]; item.Style = style; switch (style) { case Microsoft.Protocols.TestManager.Detector.LogStyle.Default: detectSteps[stepIndex].DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Detecting; break; case Microsoft.Protocols.TestManager.Detector.LogStyle.Error: stepIndex++; item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Error; break; case Microsoft.Protocols.TestManager.Detector.LogStyle.StepFailed: stepIndex++; item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Failed; break; case Microsoft.Protocols.TestManager.Detector.LogStyle.StepSkipped: stepIndex++; item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Skipped; break; case Microsoft.Protocols.TestManager.Detector.LogStyle.StepNotFound: stepIndex++; item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.NotFound; break; case Microsoft.Protocols.TestManager.Detector.LogStyle.StepPassed: stepIndex++; item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Finished; break; default: item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Pending; break; } logWriter.WriteLine("[{0}] {1}", DateTime.Now.ToString(), msg); logWriter.Flush(); }; detector.BeginDetection((outcome) => { if (stepIndex < detectSteps.Count) { detectSteps[stepIndex].DetectingStatus = TestManager.Detector.DetectingStatus.Pending; } callback(outcome); logWriter.Close(); logWriter = null; }); }
public void StartDetection(int configurationId, DetectionCallback callback) { GetAutoDetection(configurationId).StartDetection(callback); }
/// <summary> /// Start the auto-detection /// </summary> /// <param name="callback">The call back function when the detection finished.</param> public void StartDetection(DetectionCallback callback) { stepIndex = 0; detectorLog = Path.Combine(appConfig.AppDataDirectory, "Detector_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss-fff") + ".log"); logWriter = new StreamWriter(detectorLog); detector.DetectLogCallback = (msg, style) => { if (stepIndex == detectSteps.Count) return; var item = detectSteps[stepIndex]; item.Style = style; switch (style) { case Microsoft.Protocols.TestManager.Detector.LogStyle.Default: detectSteps[stepIndex].DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Detecting; break; case Microsoft.Protocols.TestManager.Detector.LogStyle.Error: stepIndex++; item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Error; break; case Microsoft.Protocols.TestManager.Detector.LogStyle.StepFailed: stepIndex++; item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Failed; break; case Microsoft.Protocols.TestManager.Detector.LogStyle.StepSkipped: stepIndex++; item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Skipped; break; case Microsoft.Protocols.TestManager.Detector.LogStyle.StepNotFound: stepIndex++; item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.NotFound; break; case Microsoft.Protocols.TestManager.Detector.LogStyle.StepPassed: stepIndex++; item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Finished; break; default: item.DetectingStatus = Microsoft.Protocols.TestManager.Detector.DetectingStatus.Pending; break; } logWriter.WriteLine("[{0}] {1}", DateTime.Now.ToString(), msg); logWriter.Flush(); }; detector.BeginDetection((outcome) => { if (stepIndex < detectSteps.Count) detectSteps[stepIndex].DetectingStatus = TestManager.Detector.DetectingStatus.Pending; callback(outcome); logWriter.Close(); logWriter = null; }); }
public FaceDetectionRects() { syncObject = new object(); consumers = UnWatched; }