System.Configuration.ConfigurationManager.RefreshSection C# (CSharp) Метод

RefreshSection() публичный статический Метод

public static RefreshSection ( string sectionName ) : void
sectionName string
Результат void
        public static void RefreshSection(string sectionName) {
            // Avoid unintended AV's by ensuring sectionName is not empty.
            // For consistency with GetSection, we should not throw an InvalidArgumentException.
            if (String.IsNullOrEmpty(sectionName)) {
                return;
            }

            PrepareConfigSystem();

            s_configSystem.RefreshConfig(sectionName);                
        }

Usage Example

Пример #1
0
        public static void UpdateDailyAnnoucement(int h, int m, int s, int interval, int loops, string command)
        {
            Configuration config = ConfManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            string delim = ConfManager.AppSettings["AnnMess"] == "" ? "" : "|";

            string annMess     = ConfManager.AppSettings["AnnMess"] + delim + command;
            string annTime     = ConfManager.AppSettings["AnnTime"] + delim + h + ":" + m;
            string annLoops    = ConfManager.AppSettings["AnnLoops"] + delim + loops;
            string annInterval = ConfManager.AppSettings["AnnInterval"] + delim + interval;

            config.AppSettings.Settings["AnnMess"].Value     = annMess;
            config.AppSettings.Settings["AnnTime"].Value     = annTime;
            config.AppSettings.Settings["AnnLoops"].Value    = annLoops;
            config.AppSettings.Settings["AnnInterval"].Value = annInterval;
            config.Save(ConfigurationSaveMode.Modified);
            ConfManager.RefreshSection("appSettings");


            //TelepresenceScheduler.DeleteDailyAnnouncement();
            //LoadDailyAnnouncement();
            Action action = new Action(() =>
            {
                SpeechGeneration.SpeakAsync(command);
            });

            TelepresenceScheduler.DailyIntervalInSeconds(h, m, s, interval, loops, action);
        }
All Usage Examples Of System.Configuration.ConfigurationManager::RefreshSection