views:

258

answers:

3

I'm using the application-scoped settings to store settings that cannot change at run-time. I'm using the user-scoped settings to let individual users configure their preferences. But how should I store/control settings that are modifiable at run-time by an admin-level user that are application wide (i.e., they impact all of the PC's users)? I suppose the admin could modify the application-scoped setting by hand, but that's not preferable.

Thanks!

A: 

My suggestion would be to store those modifiable settings in a table in a database that is fetched when the application starts to allow ease of modifying various values without having to touch the code files. This would be similar to the user configuration data that should be stored somewhere that can be easily accessed and handles changes without breaking things or triggering a recompile. This does assume some form of DB with the application, however.

JB King
A: 

You might have to handle this one yourself. Create a settings class that serializes to XML or saves in the registry (or your preferred method of storing the settings), and an options window. Save and load the settings when appropriate.

The thing to note is user-scoped settings only pertain to the logged-in user. To my knowledge, without some fancy stuff at least, you're not going to be able to edit another user's settings easily.

lc
+1  A: 

If you plan to store these settings on the computer itself, consider using the common appdata folder to store cross-user settings. This folder accessible from all users. You will need to store/read these settings yourself, and as others mentioned, you can use an xml serializer for that.

Unfortunately, it would be up to you in this case to make it admin-only accessible - any user can write to this folder (that's really the purpose here - for common settings that can be changed). If the 'admin settings' are by convention only, or obscurity of where the settings are located is enough, this might suffice.

Robert P