本文介绍了保存用户设置的 WP7 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抱歉,这是一个菜鸟问题,但我想知道如果我想创建一个应用程序来保存每次打开应用程序时的用户设置,我会从哪里开始.例如,如果我有一个用户想要将他们最喜欢的书输入到文本框中,然后将其保存到某个数组列表中,以保存他们以前的条目,那么执行此任务的最佳方法是什么?感谢您的时间和寻找和帮助!我也会在 c# 中这样做.

Sorry, this is a noobish question, but I was wondering where I would start if I wanted to create an app that saved the users settings from each time the app was openned. For example if I had a user who wanted to enter their favorite book into a text box and then that was saved to some array list that would save their previous entries what would be the best way to go about this task? Thank you for your time and looking and help! Also I would be doing this in c#.

推荐答案

您可以使用 IndependentStorageSettings 来存储首选项数据.您可以参考以下链接:http://msdn.microsoft.com/en-us/library/cc221360(v=vs.95).aspx

You can use IsolatedStorageSettings to store preference data. You can refer following link:http://msdn.microsoft.com/en-us/library/cc221360(v=vs.95).aspx

以下是示例代码片段:

IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
// txtInput is a TextBox defined in XAML.
if (!settings.Contains(key))
 {
     settings.Add(key, value);  // adding new value
     settings.Save();
 }

这篇关于保存用户设置的 WP7 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 05:10