コード例 #1
0
        private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e)
        {
            try
            {
                var saveFormat = PropertyValues.Cast <SettingsPropertyValue>()
                                 .Where(p => p.SerializedValue.ToString() != p.Property.DefaultValue.ToString())
                                 .Select(p => new Setting(p.Name, p.SerializedValue.ToString()))
                                 .ToList();

                XmlManager <List <Setting> > .Save(SettingsPath, saveFormat);

                e.Cancel = true;
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
コード例 #2
0
ファイル: Settings.cs プロジェクト: modulexcite/WFN
        // This is awesomely awful. But it fixes an issue with .Net Core 3.1 not taking the right config file
        // (at least with latest modifications), while I could swear it was working last week without this... Anyway...
        protected override void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e)
        {
            base.OnSettingsLoaded(sender, e);

            PropertyValues.Cast <SettingsPropertyValue>().ToList().ForEach(p => p.Property.Provider = provider);
        }