What is the preferred method for storing application settings in Windows Mobile applications?

I am using the .NET Compact Framework 3.5 and I am trying to determine if there is a standard way of storing settings that the user can change in my application. I know the Compact 3.5 SQL database, but I try to avoid this if I can, in order to avoid a dependency that is not already installed on the users mobile device (I already need to worry about the 3.5.NET Framework, so I try to avoid any other dependencies , if I can).

I saw that the old .config file (via System.Configuration.ConfigurationSettings.AppSettings) is deprecated and apparently not supported by the Compact Framework.

Besides filling it in the xml file stored in / Application Data / My App / and analyzing it, are there any built-in libraries for this type of function?

I do not see much online or on this site about this. Mostly compact frame solutions.

+4
source share
5 answers

I actually ended up using System.Xml.Serialization.XmlSerializer. This allowed us to save and restore settings with minimal effort. It is tolerant of changes in settings when performing updates / downgrades.

+2
source

OpenNetCF supports loading and saving settings to an xml file

the OpenNetCF.AppSettings namespace, and the SettingsFile class should do the trick :)

+2
source

I use the registry for many parameters in my application. We have created a wrapper around registry calls that handle exceptions, memory cleanup, etc. After that, it works very well. I think it all depends on what settings you say.

+1
source

After testing OpenNetCF.AppSettings and trying to create a configuration manager from scratch, I ended up using this class . It is simple and it just works.

Edit: The link above is dead, so I put the class source code here .

Using:

ConfigurationManager.AppSettings["YourSetting"] ConfigurationManager.AppSettings["YourSetting"] = "test"; 
+1
source

Another alternative option is the old old-fashioned .INI files. There are a number of pure C # classes for parsing and using values. Simple and straightforward.

0
source

Source: https://habr.com/ru/post/1300806/


All Articles