Ejemplo n.º 1
0
 protected override void OnDeleted()
 {
     if (motionDetector != null && selectedCameraIndex != -1)
     {
         motionDetector.MotionDetected -= WebCamMotionDetected;
         ReleasePreviousDetectors();
         WebcamManager.SetPropertyValueAuto(selectedCameraIndex, WebcamManager.CAMERA_PROPERTY.CAMERA_FOCUS);
         WebcamManager.SetPropertyValueAuto(selectedCameraIndex, WebcamManager.CAMERA_PROPERTY.CAMERA_ZOOM);
         WebcamManager.ReleaseInactiveCameras();
         if (callbacksRegistered)
         {
             WebcamManager.UnregisterWebcamConnectionEvent(OnCameraConnected);
             WebcamManager.UnregisterWebcamRemovalEvent(OnCameraDisconnected);
             callbacksRegistered = false;
         }
     }
 }
Ejemplo n.º 2
0
        //[MethodImpl(MethodImplOptions.Synchronized)]
        protected override void OnDisabled(DisabledEventArgs e)
        {
            if (!e.IsConfiguring)
            {
                if (faceDetector != null && selectedCameraIndex != -1)
                {
                    faceDetector.FaceDetected -= WebCamFaceDetected;
                    faceDetector.UnregisterForImages(WebcamManager.GetCamera(selectedCameraIndex));
                    ReleasePreviousDetectors();

                    WebcamManager.SetPropertyValueAuto(selectedCameraIndex, WebcamManager.CAMERA_PROPERTY.CAMERA_FOCUS);
                    WebcamManager.SetPropertyValueAuto(selectedCameraIndex, WebcamManager.CAMERA_PROPERTY.CAMERA_ZOOM);
                    WebcamManager.ReleaseInactiveCameras();
                    if (callbacksRegistered)
                    {
                        WebcamManager.UnregisterWebcamConnectionEvent(OnCameraConnected);
                        WebcamManager.UnregisterWebcamRemovalEvent(OnCameraDisconnected);
                        callbacksRegistered = false;
                    }
                }
            }
        }