9

I am using CameraCaptureUI for opening camera in my application; Here is the code what iam using

        var camera = new CameraCaptureUI();
        camera.PhotoSettings.AllowCropping = false;
        var file = await camera.CaptureFileAsync(CameraCaptureUIMode.Photo);
        if (file != null)
        {
            var fileStream = await file.OpenAsync(FileAccessMode.Read);
            var bitmapImage = new BitmapImage();
            bitmapImage.SetSource(fileStream);
            var sourceImage = new WriteableBitmap(bitmapImage.PixelWidth, bitmapImage.PixelHeight);
            var imageStream = await file.OpenAsync(FileAccessMode.Read);
            sourceImage.SetSource(imageStream);

        }

But the issue is not with camera. During the time of camera open. If we open settings charm the await function cancels var file = await camera.CaptureFileAsync(CameraCaptureUIMode.Photo); [File returns null] and hides the CameraCapture UI. What i am trying to do is i need to open my camera always even if the user opens the charm. How i can achieve this in WinRT

2
  • Have you noticed, default camera app is not facing such issue. Commented May 29, 2013 at 7:30
  • Yups. The same issue is present in CameraCaptureUI and FileOpenPicker. You can easily replicate this issues in Dropbox app by MS. Also the sample in the MSDN here is the link code.msdn.microsoft.com/windowsapps/…
    – StezPet
    Commented May 29, 2013 at 7:34

1 Answer 1

1

To solve your problem, you need to stop using the CameraCaptureUI and start using the <CaptureElement/> in a UI you specifically design for your special scenario.

I wrote this up in an article to help. Here.

Best of luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.