Memory 为什么重新启动应用程序时IsolatingStorage设置为空?(WP8)

Memory 为什么重新启动应用程序时IsolatingStorage设置为空?(WP8),memory,windows-phone-8,settings,isolatedstorage,Memory,Windows Phone 8,Settings,Isolatedstorage,我使用IsolatingStorage设置来存储对象的集合。当我的应用程序运行时,它工作得很好,但当我重新启动它时…集合是空的…为什么它不将我的对象集合保留在内存中 private void llsElements\u SelectionChanged(对象发送方,selectionchangedventargs e) { LongListSelector llselement=null; Clear(); if(发送方!=null) llselement=(LongListSelector)发

我使用IsolatingStorage设置来存储对象的集合。当我的应用程序运行时,它工作得很好,但当我重新启动它时…集合是空的…为什么它不将我的对象集合保留在内存中

private void llsElements\u SelectionChanged(对象发送方,selectionchangedventargs e)
{
LongListSelector llselement=null;
Clear();
if(发送方!=null)
llselement=(LongListSelector)发送方;
如果(llselement.SelectedItem!=null)
{
BdeskElement bdelement=(BdeskElement)llselement.SelectedItem;
if(bdelement.TypeElement==bdeskeelement.BdeskTypeElement.File)
{
如果(!IsolatedStorageSettings.ApplicationSettings.Contains(bdelement.URLElement))//IsCached?=>非
{
如果(IsolatedStorageSettings.ApplicationSettings.Count>=100)//Si la liste des fichiers en cache est pleine
{
string KeyOldestElement=IsolatedStorageSettings.ApplicationSettings.Last().Key;
IsolatedStorageSettings.ApplicationSettings.Remove(KeyOldEsteElement);//关于supprime le dernierélément de la liste
if(IsolatedStorageOperations.IsFileSaved(KeyOldTestElement+bdelement.Extension))
IsolatedStorageOperations.DeleteFile(KeyOldestElement+bdelement.Extension);
}
IsolatedStorageSettings.ApplicationSettings.Add(bdelement.URLElement,bdelement);//在路由notreélément上
下载和添加文件(b元素);
}
else//Si le Ficheer est de ja présent dans la liste(donc déja en cache)
{
if(IsFileModified(bdelement,IsolatedStorageSettings.ApplicationSettings[bdelement.URLElement])//比较缓存中的版本téléchargée和缓存中的版本/les版本sont标识
{
字符串FileNameFormated=bdelement.urlement.Replace(“/”,“”).Substring(7,bdelement.urlement.Length-7);
if(IsolatedStorageOperations.IsFileSaved(FileNameFormatted))
{
MessageBox.Show(“lefichier est lu dans Le cache”);
字节[]Encryptedbytefile=IsolatedStorageOperations.GetFile((FileNameFormatted));
字节[]UnCryptedByteFile=EncryptedString.DecryptDataToData(Encryptedbytefile);
IsolatedStorageOperations.SaveToFile(UnCryptedByteFile,“FileToRead”+bdelement.Extension);
IsolatedStorageOperations.ReadFile(“FileToRead”+bdelement.Extension);
}
}
else//les versions sont différentes
{
IsolatedStorageSettings.ApplicationSettings.Remove(bdelement.URLElement);//supprime l'Anciene版本
IsolatedStorageSettings.ApplicationSettings.Add(bdelement.urlement,bdelement);//Ajute la nouvelle
下载和添加文件(b元素);
}
}
}
else if(bdelement.TypeElement==bdeskeelement.BdeskTypeElement.Folder)
{
//l'lément cliquéevident l'lément courant
App.CurrentFolder=b元素;
//关于拉菲什·拉佩奇
NavigationService.Navigate(新Uri(String.Format(“/Views/BDocs/FolderView.xaml?id={0}”、Guid.NewGuid().ToString()、UriKind.Relative));
}
}
IsolatedStorageSettings.ApplicationSettings.Save();//已编辑
}
编辑

关于保存方法的问题


信息支持:无法序列化类型“System.Windows.Media.ImageSource”。考虑使用DATACONTractAttor属性对其进行标记,并标记要使用DATAMEMBAREATE属性序列化的所有成员。或者,您可以确保该类型是公共的,并且有一个无参数构造函数-然后将序列化该类型的所有公共成员,并且不需要任何属性。

可能是因为您没有保存它-在使用它时尝试使用它

当然,当您重新启动模拟器时,它将不起作用-重新启动后,它是一个新实例

编辑-在OP编辑之后


您无法序列化
ImageSource
——类似的问题也存在。而是考虑将IpPiaPATH系列化。

AHAH,在我发布这个消息后30秒,我理解了我的错误……但是我有一个我不理解的错误……我编辑了帖子…对不起,我的意思是当我重新启动应用程序…哦,该死的我的对象有一个BITMAPIMAGE的属性……我猜这个问题是从那里来的…这真的很烦人…(谢谢你的帮助,)PaulMARTITNZ考虑将IsPiaScript系列化,如果你真的需要对图像进行序列化,图像会很难保存。如果你继续有问题,请查看这个免费的库。EZS.ISO.DLL已经内置了保存图像的功能。你只需要做一行调用。