【发布时间】:2013-05-29 07:07:56
【问题描述】:
我正在使用 CameraCaptureUI 在我的应用程序中打开相机;这是我正在使用的代码
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);
}
但问题不在于相机。在相机打开期间。如果我们打开设置魅力,等待函数取消var file = await camera.CaptureFileAsync(CameraCaptureUIMode.Photo); [文件返回 null] 并隐藏 CameraCapture UI。我想要做的是,即使用户打开了魅力,我也需要始终打开我的相机。我如何在 WinRT 中实现这一点
【问题讨论】:
-
你有没有注意到,默认的相机应用程序没有遇到这样的问题。
-
是的。 CameraCaptureUI 和 FileOpenPicker 中也存在同样的问题。您可以在 MS 的 Dropbox 应用中轻松复制此问题。 MSDN中的示例也是链接code.msdn.microsoft.com/windowsapps/…
标签: windows-8 windows-store-apps winrt-xaml