我做了一个 UWP 应用程序。我使用漫游数据。我通过以下方式保存设置:
public static void WriteCode(string pwd)
{
ApplicationDataContainer RoamingSettings = ApplicationData.Current.RoamingSettings;
RoamingSettings.Values["Code"] = EncryptHelper.PwdEncrypt(pwd);
}
我通过以下方式阅读了设置:
public static string GetCode()
{
ApplicationDataContainer RoamingSettings = ApplicationData.Current.RoamingSettings;
string str = (String)RoamingSettings.Values["Code"];
if (!String.IsNullOrEmpty(str))
return str;
else
return EncryptHelper.PwdEncrypt("123");
}
我完成了申请并上传到 Windows 商店并通过了检查。然后我在手机上下载了这个应用程序。
我更改手机上的 ApplicationData.Current.RoamingSettings。我向手机上的 ApplicationData.Current.RoamingFolder 写入一些内容。
接下来,我关闭了手机上的应用程序,并将该应用程序下载到了我的电脑上。但是当我在电脑上打开应用程序时,我发现 ApplicationData.Current.RoamingSettings 和 ApplicationData.Current.RoamingFolder 没有改变任何内容。
我检查了我电脑上的 C:\Users\XXX\AppData\Local\Packages\XXX\RoamingState,没有任何内容。我检查了我电脑上的C:\Users\XXX\AppData\Local\Packages\XX\Settings,有roaming.lock和settings.dat。但我无法再读取我在手机上添加的最新设置和漫游数据。
我已经等了2个小时了,我的电脑上没有任何变化。
有件事我应该首先声明:
1 All the deploy work was done by windows store.
2 I check my PC application setting after closed the app on phone. I even shut down my mobile phone to observe the change to my PC.
我的代码有什么问题吗?或者漫游数据机制有什么问题?我需要答案,谢谢!