Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change application settings (Settings) while app is open?

I've written a class that should allow me to easily read and write values in app settings:

public static class SettingsManager
    {
        public static string ComplexValidationsString
        {
            get { return (string)Properties.Settings.Default["ComplexValidations"]; }
            set
            {
                Properties.Settings.Default["ComplexValidations"] = value;
                Properties.Settings.Default.Save();
            }
        }

the problem is the value isn't really saved, I mean it is not changed when I exit the application and run it again. What can I do to ensure that the saved value persists between closing and opening again?

like image 674
agnieszka Avatar asked Jul 23 '09 10:07

agnieszka


People also ask

What is application setting?

Application settings enable you to store application information dynamically. Settings allow you to store information on the client computer that shouldn't be included in the application code (for example a connection string), user preferences, and other information you need at runtime.

What does it mean when an app can modify system settings?

To appease power users by giving apps like Tasker more capabilities, there's a permission called "Modify System Settings" that can be granted. If an app has this permission, it can change Android options like your screen timeout duration.

Where are application settings stored?

User-scope settings are stored in the user's appdata folder. Application-scope settings are stored in C:\Users\My Name\AppData\Local\My_Company\. If your settings file doesn't contain any Application-scope settings, you won't have a company folder.


1 Answers

settings scope must be user not application

like image 144
Woland Avatar answered Sep 21 '22 22:09

Woland