0
我正在爲windows phone 7構建應用程序,其中我每隔1秒拍攝一張截圖,所有截圖都保存在媒體庫中,文件名是1.jpg,2.jpg,3。 JPG .........等等。現在當我從圖書館拍攝圖像時,我會隨機獲取圖像(1.jpg,2.jpg,3.jpg,7.jpg,13.jpg,4.jpg,15.jpg,5.jpg)不按順序。 我怎樣才能在sequence.here所有圖像是我的代碼從媒體庫中按順序獲取圖片
使用(MediaLibrary mediaLibrary =新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);
}
}
}
您應該在讀取之前獲得所有文件名的列表並對它們進行排序。 –