WP7 app that saves user settings

2019-09-05 16:50发布

问题:

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#.

回答1:

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

Below is sample code snippet:

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


回答2:

Properties.Settings In your application configuration file. Use the project properties section to add parameters.

Right click "" in Visual studio -> Click "Properties" -> On the left pane of project properties tab you can find "Settings" section.



回答3:

your options are : Database: -http://www.codeproject.com/Tips/378657/Quickest-Way-to-Create-a-NET-Database-Application

-Or file storage. -Or XML file.



回答4:

While many things are different for WP8, the persistent settings mechanisms are backwardly compatible. Do the relevant part of this course: http://www.microsoftvirtualacademy.com/training-courses/windows-phone-8-apps-development-jumpstart

I'd ask why you are writing new code for an obsolete platform but I expect the reason is that you own a WP7. While there are undoubtedly many WP7 units around giving good service, the people still using them are people who resist buying stuff, so they are not your market. I heartily recommend picking up a Nokia Lumia 520, which can be had new for $AU150 and probably even cheaper in the US. Or you could go upmarket if you have the cash and inclination.

Unlike a budget Android phone, a budget WP8 phone has a very similar user experience to a high end phone; the differences are primarily absence of sensors like magnetic compass, RFID and gyros. The 520 isn't silky like my 920, but it's quite usable, whereas the budget Android phone I use for testing apps is truly a horror. Which is, I imagine, the reason the 520 is taking the European budget smartphone market by storm.