appsettings

Reading dll.config (not app.config!) from a plugin module

浪子不回头ぞ 提交于 2019-11-26 11:02:42
问题 I am writing a C# .NET 2.0 .dll that is a plug in to a Larger application. The visual studio project for my module has a app.config file which is copied to a MyProj.dll.config along side of MyProj.dll. The plan is that MyProj.dll.config will be edited after the .dll is deployed. I am trying to read my settings from that modified local file. I have tried pulling out the LocalFilesSettingsObject and changing it\'s application name to my .dll like this: Properties.Settings config = Properties

Bind to a value defined in the Settings

核能气质少年 提交于 2019-11-26 10:30:34
In WPF, Can I use binding with values defined in Settings? If this is possible, please provide a sample. CSharper First, you need to add a custom XML namespace that will design the namespace where the settings are defined: xmlns:properties="clr-namespace:TestSettings.Properties" Then, in your XAML file, access the default settings instance using the following syntax: {x:Static properties:Settings.Default} So here is the final result code: <ListBox x:Name="lb" ItemsSource="{Binding Source={x:Static properties:Settings.Default}, Path=Names}" /> Source: WPF - How to bind a control to a property

Restoring Window Size/Position With Multiple Monitors

柔情痞子 提交于 2019-11-26 10:18:18
问题 Many posts around about restoring a WinForm position and size. Examples: www.stackoverflow.com/questions/92540/save-and-restore-form-position-and-size www.codeproject.com/KB/dialog/restoreposition.aspx?fid=1249382&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2595746 But I have yet to find code to do this with multiple monitors. That is, if I close my .NET Winform app with the window on monitor 2, I want it to save the windows size, location, and state to the application settings, so

Encrypting appSettings in web.config

半腔热情 提交于 2019-11-26 08:19:12
问题 I am developing a web app which requires a username and password to be stored in the web.Config, it also refers to some URLs which will be requested by the web app itself and never the client. I know the .Net framework will not allow a web.config file to be served, however I still think its bad practice to leave this sort of information in plain text. Everything I have read so far requires me to use a command line switch or to store values in the registry of the server. I have access to

ConfigurationManager.AppSettings - How to modify and save?

喜夏-厌秋 提交于 2019-11-26 08:07:15
问题 It might sound too trival to ask and I do the same thing as suggested in articles, yet it doesn\'t work as expected. Hope someone can point me to the right direction. I would like to save the usersettings per AppSettings. Once the Winform is closed I trigger this: conf.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); if (ConfigurationManager.AppSettings[\"IntegrateWithPerforce\"] != null) ConfigurationManager.AppSettings[\"IntegrateWithPerforce\"]

Change Azure website app settings from code

做~自己de王妃 提交于 2019-11-26 07:48:27
问题 Is it possible to change the app settings for a website from the app itself? This is not meant to be an everyday operation, but a self-service reconfiguration option. A non-developer can change a specific setting, which should cause a restart, just like I can do manually on the website configuration page (app setting section) 回答1: It wasn't that hard once I found the right lib to do it, Microsoft Azure Web Sites Management Library. var credentials = GetCredentials(/*using certificate*/);

What is the difference between app.config file and XYZ.settings file?

十年热恋 提交于 2019-11-26 07:24:24
问题 I am actually in the learning phase of .NET related stuff and I was exploring how to save the application. I ended up writing my own class which saves the settings in an XML file and then I found that .NET itself supports saving application settings. But I found 2 ways to do that. When I open add new item dialog in Visual Studio 2008, it gives option to create Settings file (.settings) or a configuration file (.config). Whats the difference between both and in what scenario they should be

AppSettings get value from .config file

我只是一个虾纸丫 提交于 2019-11-26 05:24:23
问题 I\'m not able to access values in configuration file. Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var clientsFilePath = config.AppSettings.Settings[\"ClientsFilePath\"].Value; // the second line gets a NullReferenceException .config file : <?xml version=\"1.0\" encoding=\"utf-8\" ?> <configuration> <appSettings> <!-- ... --> <add key=\"ClientsFilePath\" value=\"filepath\"/> <!-- ... --> </appSettings> </configuration> Do you have any

Why isn&#39;t there an XML-serializable dictionary in .NET?

妖精的绣舞 提交于 2019-11-26 03:33:34
问题 I need an XML-serializable dictionary. Actually, I now have two quite different programs that need one. I was rather surprised to see that .NET doesn\'t have one. I asked the question elsewhere and got sarcastic responses. I don\'t understand why it\'s a stupid question. Can someone enlighten me, given how dependent various .NET features are on XML serialization, why there isn\'t an XML-serializable dictionary. Hopefully, you can also explain why some people consider that a daft question. I

manual language selection in an iOS-App (iPhone and iPad)

感情迁移 提交于 2019-11-26 02:27:59
问题 My question: How can my iPhone-app tell the iOS, that the user did select a language in the apps preferences, that is different from the language set in the general settings? Other formulation of the same question: How can i tell the system, that NSLocalizedString (@\"text\", @\"comment\"); should not access the systemwide selected language, but the in-app-selected language? background, example: Please take this situation as an example: A son of german immigrants is living in the north-east