application-settings

Can someone provide a quick App.config/Web.config tutorial?

假装没事ソ 提交于 2019-11-28 23:58:56
I've used these two configuration files many times before, but I've never taken the time to fully understand how they really work. As most people do, I understand the basics in how to call WebConfigurationManager.AppSettings["key"] to get config values. Here are some questions I came up with: What happens when you reference a configuration value within a class library, and the library is part of a bigger solution? Does the app.config need to be copied to the output directory in order for the variables to be found? (I assume yes) Can you directly use a configuration value from an app.config in

Save little information as setting in android (like first time that app is run)

倾然丶 夕夏残阳落幕 提交于 2019-11-28 23:04:35
I want to save a flag for recognizing that my app is run for the first time or not. For this simple job I don't want to create database.. Is there a simple option to do this? I want to save and read little pieces of information only. Use SharedPreferences . SharedPreferences preferences = getSharedPreferences("prefName", MODE_PRIVATE); SharedPreferences.Editor edit= preferences.edit(); edit.putBoolean("isFirstRun", false); edit.commit(); Use sharedPreference or files to save the data but better option is sharedPreference . For Retrieving SharedPreferences settings = getSharedPreferences(PREFS

Why aren't .NET “application settings” stored in the registry?

亡梦爱人 提交于 2019-11-28 18:17:32
Some time back in the nineties, Microsoft introduced the Windows Registry. Applications could store settings in different hives. There were hives for application-wide and user-specific scopes, and these were placed in appropriate locations, so that roaming profiles worked correctly. In .NET 2.0 and up, we have this thing called Application Settings . Applications can use them to store settings in XML files, app .exe.config and user .config. These are for application-wide and user-specific scopes, and these are placed in appropriate locations, so that roaming profiles work correctly. Sound

Where to store Application Data in Windows 7 and Vista

自作多情 提交于 2019-11-28 11:04:48
My application needs to, like most, store data. The application was previously used on XP only where it would store the data in Program Files . Now that our customers are moving to Windows 7 I had to upgrade it so that it stored the data in a new folder. I opted for the ApplicationData folder as I thought I would be allowed access without needing UAC at all. Now on some Windows 7 machines this is fine, but on others access to the folder fails, presumably because of permissions, but when ran with Administrator privelidges the program works fine. Am I using the wrong folder or are these cases

Blackberry - application settings save/load

你说的曾经没有我的故事 提交于 2019-11-28 09:33:43
I know two ways to save/load application settings: use PersistentStore use filesystem (store, since SDCard is optional) I'd like to know what are you're practicies of working with application settings? Using PersistentStore to save/load application settings The persistent store provides a means for objects to persist across device resets. A persistent object consists of a key-value pair. When a persistent object is committed to the persistent store, that object's value is stored in flash memory via a deep copy. The value can then be retrieved at a later point in time via the key. Example of

Error: 'Cannot create unknown type '{clr-namespace:NameSpace.Properties}Settings'.'

有些话、适合烂在心里 提交于 2019-11-28 07:15:13
I define my settings and styles in a ResourceDictionary: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:properties="clr-namespace:Kavand.UI.Properties"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary> <properties:Settings x:Key="settings" /> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> <Style x:Key="PopupMenu_StackPanel"> <Setter Property="TextBlock.FontSize" Value="{Binding Source={StaticResource settings}, Path=Default.Font_Menu_Size}" /> <Setter Property=

How to retrieve values from settings.bundle in objective c?

你。 提交于 2019-11-28 06:24:48
I have created a project that set and retrieve values from settings.bundle . I have also set some defaults values in settings.bundle file. Now the problem is when I retrieve values as NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; loginName.text = [defaults objectForKey:@"login_name"]; for the first time it shows null, but the values get set in iPhone application settings. If I change the values or set it manually, then values are retrieved properly. Help me out Although you define the defaults settings, they are not really stored as a value. They are stored as default. If

Difference between 'SpecialFolder.LocalApplicationData' and 'SpecialFolder.ApplicationData'?

半腔热情 提交于 2019-11-28 04:52:50
On my system, %AppData% leads to ApplicationData which is C:\Users\<USER>\AppData\Roaming But there is also C:\Users\<USER>\AppData\Local And for some more confusion D:\Users\<USER>\AppData\LocalLow string local = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); string roaming = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); My question is, to which of these locations should my application save its data? Are there guidelines for which of these locations to use? And am I leaving myself open to problems if I choose the wrong location? The Roaming

Ways of keeping configuration code out of logic code using Dependency Injection

两盒软妹~` 提交于 2019-11-28 04:40:32
How can keep all the configuration file code out of my logic code using Settings (ApplicationSettingsBase) and Dependency Injection? With configuration I mean a customer specific configuration file. Do I really have to inject a configuration class everytime I need it or is there another pattern? It would be great to get some sample code! Samples: Static Configuration: public static class StaticConfiguration { public static bool ShouldApplySpecialLogic { get; set; } public static string SupportedFileMask { get; set; } } public class ConsumerOfStaticConfiguration { public void Process() { if

App.config: User vs Application Scope

你说的曾经没有我的故事 提交于 2019-11-28 03:17:49
I have added App.config file in my project. I have created two settings from Project > Properties > Settings panel - I have noticed that when I am adding a setting, I can define scope as User or Application . - User Application If I define setting as User it goes to userSettings section, if I define setting as Application it goes to applicationSettings section App.config <configuration> <userSettings> <DemoApp.Properties.Settings> <setting name="MySetting1" serializeAs="String"> <value>Value1</value> </setting> </DemoApp.Properties.Settings> </userSettings> <applicationSettings> <DemoApp