简体   繁体   English

MvvmCross PictureChooser插件在Windows Phone 8.1中不起作用

[英]MvvmCross PictureChooser Plugin is not working in Windows Phone 8.1

I am developing an Windows Phone 8.1 app using MvvmCross. 我正在使用MvvmCross开发Windows Phone 8.1应用程序。 However, I am unable to use Picture Chooser Plugin. 但是,我无法使用Picture Chooser插件。

Picture Chooser: 图片选择器:

I am calling: 我正在打电话:

Stream tt= await priChooserTask.ChoosePictureFromLibraryAsync(1024, 95);

A File Picker will open choose file but the Stream is always null. 文件选择器将打开选择文件,但流始终为空。 await call never return stream. 等待呼叫永不返回流。

I also tried the PictureTaking sample, but it is not working on Windows phone 8.1 Stream is always null. 我也尝试了PictureTaking示例,但在Windows Phone 8.1上不起作用。Stream始终为null。

I had found this article , however it didnt work for me (i got some exceptions and camera stopped to work at all) so i needed to go deeper. 我找到了这篇文章 ,但是对我没用(我有一些例外,相机也停止工作了),所以我需要更深入。

In MvxPictureChooserTask, i added 在MvxPictureChooserTask中,我添加了

        var capture = new MediaCapture();
        await capture.InitializeAsync(new MediaCaptureInitializationSettings {PhotoCaptureSource = PhotoCaptureSource.Photo}); // New line
        await capture.StartPreviewAsync(); // New line
        await capture.CapturePhotoToStorageFileAsync(encoding, file);

but that didnt work for me either. 但这对我也不起作用。

As i understood, there's no "chosers" in WP 8.1 anymore. 据我了解,WP 8.1中不再有“选择器”。 We cant ask system "please, make a photo and return it to me" like it was in 8.0 and earlier. 我们不能要求系统像8.0或更早的版本那样“请拍张照片并将其退还给我”。 Now we have to create our own view with CaptureElement and MediaCapture. 现在,我们必须使用CaptureElement和MediaCapture创建自己的视图。 I dunno how to move that into a plugin yet, but if to talk about Windows implementation, something like this works fine for me. 我不知道如何将其移动到插件中,但是如果要谈论Windows的实现, 这种方法对我来说很好。

Edit: here is another sample that works fine, but still it is WP 8.1. 编辑: 这是另一个工作正常的示例 ,但仍然是WP 8.1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM