示例#1
0
        /// <summary>
        /// Writes config settings to settings json file.
        /// </summary>
        public void SaveChanges()
        {
            bool anyChanges = false;

            foreach (var uiitem in SettingItems)
            {
                var settingItem = _settingSource.Items.Where(x => x.Key == uiitem.Key && uiitem.IsModified).FirstOrDefault();

                if (!object.ReferenceEquals(null, settingItem))
                {
                    settingItem.CurrentValue = uiitem.CurrentValue ?? string.Empty;
                    anyChanges = true;
                }
            }

            if (anyChanges)
            {
                _settingSource.SaveChanges();
                BurnsBac.WindowsAppToolkit.Services.MessageBus.MessageBus.Notify(this, nameof(SettingsChangedNotification), new EventArgs());
            }
        }