{"id":133,"date":"2013-07-09T17:55:42","date_gmt":"2013-07-09T13:55:42","guid":{"rendered":"http:\/\/infobs.athn.ru\/?p=133"},"modified":"2013-07-09T17:55:42","modified_gmt":"2013-07-09T13:55:42","slug":"wpf-sohranenie-nastroek-v-app-config","status":"publish","type":"post","link":"https:\/\/infobase.athn.ru\/program\/2013\/07\/wpf-sohranenie-nastroek-v-app-config\/","title":{"rendered":"WPF \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0432 App.config"},"content":{"rendered":"<p>\u0414\u0432\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 (\u043f\u043e\u0447\u0442\u0438 \u043a\u0430\u043a \u043e\u0434\u0438\u043d), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c (\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438). \u0411\u0443\u0434\u0443 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f.<\/p>\n<pre>\nConfiguration oConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);\noConfig.AppSettings.Settings[\"PreferenceToRemember\"].Value = \u201cNewValue\u201d;\noConfig.Save(ConfigurationSaveMode.Full);\nConfigurationManager.RefreshSection(\u201dappSettings\u201d);\n<\/pre>\n<p>http:\/\/stackoverflow.com\/questions\/305529\/how-to-update-appsettings-in-a-wpf-app<\/p>\n<pre>exePath = Path.Combine( exePath, \"MyApp.exe\" );\n    Configuration config = ConfigurationManager.OpenExeConfiguration( exePath );\n    var setting = config.AppSettings.Settings[SettingKey];\n    if (setting != null)\n    {\n        setting.Value = newValue;\n    }\n    else\n    {\n        config.AppSettings.Settings.Add( SettingKey, newValue);\n    }\n\n    config.Save();\n<\/pre>\n<p>http:\/\/stackoverflow.com\/questions\/3638754\/how-can-i-read-write-app-config-settings-at-runtime-without-using-user-settings<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u0432\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 (\u043f\u043e\u0447\u0442\u0438 \u043a\u0430\u043a \u043e\u0434\u0438\u043d), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c (\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438). \u0411\u0443\u0434\u0443 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f. Configuration oConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); oConfig.AppSettings.Settings[&#171;PreferenceToRemember&#187;].Value = \u201cNewValue\u201d; oConfig.Save(ConfigurationSaveMode.Full); ConfigurationManager.RefreshSection(\u201dappSettings\u201d); http:\/\/stackoverflow.com\/questions\/305529\/how-to-update-appsettings-in-a-wpf-app <a class=\"more-link\" href=\"https:\/\/infobase.athn.ru\/program\/2013\/07\/wpf-sohranenie-nastroek-v-app-config\/\">Continue Reading \u2192<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[57,68,132,228],"class_list":["post-133","post","type-post","status-publish","format-standard","hentry","category-csharp","tag-app-config","tag-configurationmanager","tag-wpf","tag-nastroyki"],"_links":{"self":[{"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/posts\/133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/comments?post=133"}],"version-history":[{"count":0,"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/posts\/133\/revisions"}],"wp:attachment":[{"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/media?parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/categories?post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infobase.athn.ru\/program\/wp-json\/wp\/v2\/tags?post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}