c# - 获取本地照片 Windows Phone 8 模拟器

标签 c# windows-phone-8 emulation photos

所以我在 Windows Phone 模拟器上拍摄了一些照片,然后尝试在我的应用程序中找到它们。 到目前为止我已经:

PictureCollection CameraRollPictures;
using (var library = new MediaLibrary())
{
    //taking all albums
     PictureAlbumCollection allAlbums = library.RootPictureAlbum.Albums;
     //taking Camera Roll album separately from all album
     PictureAlbum cameraRoll = allAlbums.Where(album => album.Name == "Camera Roll").FirstOrDefault();
     // here you will get camera roll picture list
     CameraRollPictures = cameraRoll.Pictures;
}

但是这一直崩溃,因为cameraRoll = null。此功能在 WP8 模拟器上可用还是我做错了什么?

我获取照片的方法是来自 this stackoverflow question

编辑 我也尝试过album.Name ==“相机胶卷”

Windows Phone Photos

最佳答案

所以答案很简单...我的方法非常有效,但我需要:

  • 进入 WMAppManifest.Xml
  • 转到“功能”
  • 勾选ID_CAP_MEDIALIB_PHOTO

这提供了对媒体库中照片的只读访问

关于c# - 获取本地照片 Windows Phone 8 模拟器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25206124/

相关文章:

audio - Windows Phone 8 中的 SHOUTcast 流

.net - Windows.System.Threading.ThreadPool 和 System.Threading.ThreadPool 有什么区别?

c# - WP8 : LongListMultiSelector Tap Item Trigger MVVM

Android 模拟器 - 缺少快照选项?

Android 应用程序未正确加载到 AVD 中

android - Linux 中的模拟器键盘输入

C# WebAPI 没有正确序列化动态属性

c# - 在 C# 中为可调制后端使用泛型类型安全?

c# - 在 C# winforms 中使用 Web 服务填充 Gridview

c# - 如何允许方法接受字符串或整数?