后台任务和写入隔离存储
我正在努力在后台任务中写入独立存储。这样做的原因是,在每次运行后台任务时,我都会下载数据,并且需要在下次后台任务运行时比较这些数据。如果数据发生更改,则会显示 Toast 通知。
问题是我写入隔离存储的数据未保存。我可以在 OnInvoke 函数的其余部分使用它,但下次后台任务运行时该值消失了。
我是不是错过了什么,我以为这很容易?
编辑: 读取值工作得很好,从我的主应用程序写入值也工作得很好 我在 OnInvoke 函数中使用的代码是这样的:
IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
settings["WebValue"] = gtResult[i];
I'm struggeling with writing to the isolated storage in my background task. The reason for this is that in every run of the background task I'm downloadng data and I need to compare this data the next time the background task runs. If the data has changed then a toast notification is shown.
Problem is that the data I'm writing to the isolated storage is not saved. I can use it in the rest of the OnInvoke function but the next time the background task runs the value is gone.
Am I missing something here, I thought this was going to be easy?
EDIT:
Reading values works just fine and writing values from my main app also works just fine
The code I'm using in my OnInvoke function is this:
IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
settings["WebValue"] = gtResult[i];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许
settings.Save();
应该这样做?Maybe
settings.Save();
should do it?