C# 从媒体库获取图像

C# 从媒体库获取图像,c#,windows-phone-7,windows-phone-8,C#,Windows Phone 7,Windows Phone 8,我在从媒体库获取图像时遇到一些问题,我想知道是否有任何选项可以仅获取或自动过滤库中的某些图像。 例如,假设我有像1.jpg、2.jpg、3.jpg……等的图像。我从媒体库中获取图像,并将所有图像保存在独立存储中,所以我只想从媒体库中获取某些图像,而不是所有图像,这是我的代码 using (MediaLibrary mediaLibrary = new MediaLibrary()) { PictureCollection AllScreenShot = mediaLibrary.

我在从媒体库获取图像时遇到一些问题,我想知道是否有任何选项可以仅获取或自动过滤库中的某些图像。 例如,假设我有像1.jpg、2.jpg、3.jpg……等的图像。我从媒体库中获取图像,并将所有图像保存在独立存储中,所以我只想从媒体库中获取某些图像,而不是所有图像,这是我的代码

 using (MediaLibrary mediaLibrary = new MediaLibrary())  
{
     PictureCollection AllScreenShot = mediaLibrary.Pictures;
     foreach (Picture picture in AllScreenShot)
     {
       using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
           {
              if (!storage.DirectoryExists("SavedImg"))
                            storage.CreateDirectory("SavedImg");

                        if (storage.FileExists("SavedImg" + "\\" + picture.Name))
                            storage.DeleteFile("SavedImg" + "\\" + picture.Name);
                        using (IsolatedStorageFileStream file = storage.CreateFile("SavedImg" + "\\" + picture.Name))
                            picture.GetImage().CopyTo(file);
            }
       }
 }
这会有帮助的

var picture = media.Pictures.FirstOrLast(p => p.Name.Contains("1.jpg"));

        if (picture == null)
        {
            // 1.jpg not found
        }
        else
        {
           //1.jpg found
        }

谢谢Jeeva,您能告诉我如何从媒体库中按顺序获取图像吗?因为当我获取图像时,图像会随机返回,而不是按顺序返回;FileInfo[]files=new System.IO.DirectoryInfo().GetFiles(@“path*.bmp”).OrderBy(file=>file.Name).ToArray()