예제 #1
0
파일: WebCam.cs 프로젝트: Cacowned/mayhem
 public bool ConfigureCamera()
 {
     if (_index > -1 && _index < DllImport.GetNumberOfConnectedWebCams() && _isavailable)
     {
         return(DllImport.ConfigureCameraProperties(_index));
     }
     else
     {
         return(false);
     }
 }
예제 #2
0
        private static void UpdateCameraList()
        {
            DllImport.RefreshWebcams();
            _numdetectedCameras = DllImport.GetNumberOfConnectedWebCams();
            _detectedCameras    = new List <WebCam>();
            _availableFlags     = new List <bool>();
            for (int i = 0; i < _numdetectedCameras; i++)
            {
                string cameraName  = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(DllImport.GetWebCamName(i));
                string cameraPath  = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(DllImport.GetWebCamPath(i));
                bool   isAvailable = DllImport.IsWebCamAvailable(i);
                WebCam camera      = new WebCam(cameraName, cameraPath, i, isAvailable);

                _detectedCameras.Add(camera);
                _availableFlags.Add(isAvailable);
            }
        }