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
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With