简体   繁体   English

从Windows Phone 10上的FileOpenPicker访问摄像头

[英]Access camera from FileOpenPicker on Windows Phone 10

I'm displaying the photos gallery with the following code: 我正在使用以下代码显示照片库:

FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openPicker.FileTypeFilter.Add(".jpg");
openPicker.FileTypeFilter.Add(".jpeg");
openPicker.FileTypeFilter.Add(".png");
filePicker.PickSingleFileAndContinue();

In Windows Phone 8.1 the FileOpenPicker is showing the camera button in the ApplicationBar . 在Windows Phone 8.1中, FileOpenPicker显示ApplicationBar的相机按钮。

When using the same code for Windows Phone 10 a confirm and cancel button is shown instead of the camera. 当为Windows Phone 10使用相同的代码时,将显示确认和取消按钮而不是相机。

How do I show the camera button as in 8.1? 如何在8.1中显示相机按钮?

Tapping Choose location in the ApplicationBar will prompt you with a list of supported apps for photos, including the camera. 点击在ApplicationBar Choose location将提示您支持照片的应用程序列表,包括相机。

Even though I find this less prominent (and weird localisation) than Windows Phone 8.1, I guess this is the way to go to launch the camera. 即使我发现这不如Windows Phone 8.1那么突出(和奇怪的本地化),我想这是推出相机的方法。

It is not possible to show the camera button in the application bar in a Windows 10 Mobile app. 无法在Windows 10移动应用程序的应用程序栏中显示相机按钮。 However, if you do not specify a SuggestedStartLocation, the camera option will be shown upfront in a menu together with other options like files and photos. 但是,如果您未指定SuggestedStartLocation,则相机选项将与菜单和照片等其他选项一起显示在菜单中。

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

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