【问题标题】:Opening settings charm while Camera open closes the camera in windows 8 / WinRT打开相机时打开设置魅力关闭 Windows 8 / WinRT 中的相机
【发布时间】: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


【解决方案1】:

要解决您的问题,您需要停止使用CameraCaptureUI,并开始在您专门为您的特殊场景设计的用户界面中使用<CaptureElement/>

我在一篇文章中写了这篇文章以提供帮助。 Here

祝你好运!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多