简体   繁体   English

Windows 8.1 Store App,在应用程序状态之间保存用户变量

[英]Windows 8.1 Store App, saving user variables between app states

I am currently making a Windows 8.1 store app that acts as a task manager for user created events. 我目前正在制作一个Windows 8.1存储应用程序,充当用户创建的事件的任务管理器。
I need to save a variable so that if the user terminates the app it persists. 我需要保存一个变量,以便如果用户终止应用程序,该变量仍然存在。 Declared in MainPage.xaml.cs I have this list 在MainPage.xaml.cs中声明,我有此列表

public static ObservableCollection<events> eventsList = new ObservableCollection<events>();

Is there an easy way to save this so that the events a user creates are always there? 是否有一种简单的方法来保存此设置,以便用户创建的事件始终存在? I have read several of the MSDN pages on application state and most either seem to be for simple strings or ints. 我已经阅读了一些有关应用程序状态的MSDN页面,大多数似乎都是针对简单的字符串或整数的。 I appreciate any help offered. 我感谢提供的任何帮助。

Its better if you integrate SQlite and save your tasks inside your database. 如果您集成SQlite并将任务保存在数据库中,那就更好了。 Sqlite would be a better option as then it would be easier to manage different tasks that user creates you can easily add the specific fields that you need and query results easily. Sqlite将是一个更好的选择,因为这样可以更轻松地管理用户创建的不同任务,您可以轻松添加所需的特定字段并轻松查询结果。
Else you can use LocalStorage to save your variable values locally(though I havent used it to save a list value, and am not sure if it allows also). 另外,您可以使用LocalStorage在本地保存变量值(尽管我还没有使用它来保存列表值,并且不确定是否也允许它)。
Though if you meant between app states then you must be looking for Suspension Manager to save state values during suspended mode. 尽管如果要在应用程序状态之间进行转换,则必须在挂起模式下寻找Suspension Manager以保存状态值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM