Beispiel #1
0
        private void ResolveCameraAndFlashInfo()
        {
            HasBackCamera       = false;
            HasFrontCamera      = false;
            HasBackCameraFlash  = false;
            HasFrontCameraFlash = false;

            try
            {
                HasBackCamera  = PhotoCaptureDevice.AvailableSensorLocations.Contains <CameraSensorLocation>(CameraSensorLocation.Back);
                HasFrontCamera = PhotoCaptureDevice.AvailableSensorLocations.Contains <CameraSensorLocation>(CameraSensorLocation.Front);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(DebugTag
                                                   + ".ResolveCameraAndFlashInfo(): Failed to resolve the camera availability: "
                                                   + e.ToString());
            }

            if (HasBackCamera)
            {
                var cam = new Microsoft.Devices.PhotoCamera(Microsoft.Devices.CameraType.Primary);
                HasBackCameraFlash = cam.IsFlashModeSupported(Microsoft.Devices.FlashMode.On);
            }

            if (HasFrontCamera)
            {
                var cam = new Microsoft.Devices.PhotoCamera(Microsoft.Devices.CameraType.FrontFacing);
                HasFrontCameraFlash = cam.IsFlashModeSupported(Microsoft.Devices.FlashMode.On);
            }
        }
        private void ResolveCameraAndFlashInfo()
        {
            HasBackCamera = false;
            HasFrontCamera = false;
            HasBackCameraFlash = false;
            HasFrontCameraFlash = false;

            try
            {
                HasBackCamera = PhotoCaptureDevice.AvailableSensorLocations.Contains<CameraSensorLocation>(CameraSensorLocation.Back);
                HasFrontCamera = PhotoCaptureDevice.AvailableSensorLocations.Contains<CameraSensorLocation>(CameraSensorLocation.Front);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(DebugTag
                    + ".ResolveCameraAndFlashInfo(): Failed to resolve the camera availability: "
                    + e.ToString());
            }

            if (HasBackCamera)
            {
                var cam = new Microsoft.Devices.PhotoCamera(Microsoft.Devices.CameraType.Primary);
                HasBackCameraFlash = cam.IsFlashModeSupported(Microsoft.Devices.FlashMode.On);
            }

            if (HasFrontCamera)
            {
                var cam = new Microsoft.Devices.PhotoCamera(Microsoft.Devices.CameraType.FrontFacing);
                HasFrontCameraFlash = cam.IsFlashModeSupported(Microsoft.Devices.FlashMode.On);
            }
        }