我想在wp7文件系统上保存一个文本文件,该文件在卸载应用程序时不会被删除。
我想保存应用程序的版本和用户选择的语言首选项,这样它就不会在用户升级应用程序时被删除。我不想使用IsolatedStorage,我想使用设备的文件系统。这个是可能的吗?如果是,如何?到目前为止,我这样做:
public void SaveLanguageAndVersion()
{
IsolatedStorageFile appInfoFile = IsolatedStorageFile.GetUserStoreForApplication();
//create new file
using (StreamWriter writetoAppInfo = new StreamWriter(new IsolatedStorageFileStream("appInfo.txt", FileMode.Create, FileAccess.Write, appInfoFile)))
{
string appVer = new StringBuilder().Append(Utils.getRelVersion()).Append(":").Append(Utils.getFWversion()).ToString();
writetoAppInfo.WriteLine(appVer);
string appLanguage = CacheManager.getInstance().getApplicationSettings(Utils.APP_LANG);
writetoAppInfo.WriteLine(appLanguage);
writetoAppInfo.Close();
}
}但在卸载应用程序时,appinfo.txt文件会被删除。我想克服这一点。
如果我使用LINQ SQL,我能克服这个问题并实现我想要的吗?例如,保存应用程序级别信息,如版本和用户选择的语言?
发布于 2012-07-19 16:38:30
这是不可能的。如果您想要特定于设备/用户的数据,请考虑使用ANID或设备ID并将其存储在云中
看看这篇文章。提供有关如何获取ANID和DeviceID http://www.nickharris.net/2010/09/windows-phone-7-how-to-find-the-device-unique-id-windows-live-anonymous-id-and-manufacturer/的信息
发布于 2012-07-19 16:38:13
Windows Phone 7在允许用户在应用程序独立存储之外进行更改方面相当挑剔。
您可以做的是将首选项保存在云中,并使用设备id或用户id作为密钥。当用户重新安装应用程序时,可以下载首选项。
https://stackoverflow.com/questions/11556886
复制相似问题