Windows phone 7 将照片存储在独立存储器中,并在无内存消耗的情况下读取多张照片
我将用户的照片存储在独立的存储中,并将其显示在列表框中。我使用以下代码从独立存储中检索图像Windows phone 7 将照片存储在独立存储器中,并在无内存消耗的情况下读取多张照片,windows-phone-7,isolatedstorage,Windows Phone 7,Isolatedstorage,我将用户的照片存储在独立的存储中,并将其显示在列表框中。我使用以下代码从独立存储中检索图像 BitmapImage bi = new BitmapImage(); var isoFile = IsolatedStorageFile.GetUserStoreForApplication(); if (isoFile.FileExists(imageFileName)) { using (var image
BitmapImage bi = new BitmapImage();
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
if (isoFile.FileExists(imageFileName))
{
using (var imageStream = isoFile.OpenFile(
imageFileName,
FileMode.Open, FileAccess.Read))
{
//imageSource = PictureDecoder.DecodeJpeg(imageStream);
bi.SetSource(imageStream);
}
}
isoFile.Dispose();
//return imageSource;
return bi;
存储了100个图像。每次加载图像时,内存消耗会不断增加,然后耗尽内存。是否有更好的方法以更少的内存消耗访问图像。我使用GC.Collect,即使在加载结束时也是如此。它根本不起作用
是否有更好的方法从隔离存储器中扫描和读取图像
我允许我的用户将照片保存在独立的存储上。在我的情况下,隔离存储是更好的选择吗?Stefan Wick在他的博客 处理完图像后,只需将图像和内部位图图像强制设置为null即可释放内存
BitmapImage bitmapImage = image.Source as BitmapImage;
bitmapImage.UriSource = null;
image.Source = null;
您希望同时显示多个图像,还是一次只显示一个图像?一次加载的一组图像加载后所有图像都会解压缩,因此它们的内存占用非常大。另外,您是重复使用图像控件来显示图像还是创建新的图像控件?不要忘记将位图图像设置为null以删除它们。我有一个列表框。我正在将位图绑定到图像标记。我不知道该把它放在哪里。。