本文介绍了Windows Phone 8:如何将文件从SavedPictures文件夹读取到字节缓冲区中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何使用MediaLibrary类的Pictures/RootPictureAlbum/SavedPicture API访问SavedPicture文件夹中的照片并将它们读入字节缓冲区?

How can we use Pictures/RootPictureAlbum/SavedPicture API of MediaLibrary class to access the photos in SavedPicture folder to read them into byte buffer?

推荐答案

尝试这种方式

        using (var library = new MediaLibrary())
        {

            var savedPictures = library.Pictures.ToList();
            if (savedPictures.Any())
            {
                foreach (var pic in savedPictures)
                {
                    var bitmap = new WriteableBitmap(pic.Width, pic.Height);
                    using (var stream = pic.GetImage()) //here you will get the stream
                    {

                        bitmap.SetSource(stream);

                    }
                }
            }
        }

这篇关于Windows Phone 8:如何将文件从SavedPictures文件夹读取到字节缓冲区中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 18:18
查看更多