Пример #1
0
        public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection collection)
        {
            SettingsPropertyValueCollection values = new SettingsPropertyValueCollection();

            foreach (SettingsProperty property in collection)
            {
                if (SettingsPropertyExtensions.IsUserScoped(property))
                {
                    SettingsPropertyValue value = SimpleSettingsStore.Instance.CurrentUserValues[property.Name] ?? new SettingsPropertyValue(property);
                    values.Add(value);
                }
                else
                {
                    SettingsPropertyValue value = SimpleSettingsStore.Instance.CurrentSharedValues[property.Name] ?? new SettingsPropertyValue(property);
                    values.Add(value);
                }
            }

            return(values);
        }
Пример #2
0
        public void Upgrade(SettingsContext context, SettingsPropertyCollection properties)
        {
            foreach (SettingsProperty property in properties)
            {
                if (!SettingsPropertyExtensions.IsUserScoped(property))
                {
                    continue;
                }

                SettingsPropertyValue previousValue = SimpleSettingsStore.Instance.PreviousUserValues[property.Name];
                if (previousValue == null)
                {
                    continue;
                }

                SettingsPropertyValue currentValue = SimpleSettingsStore.Instance.CurrentUserValues[property.Name];
                if (currentValue == null)
                {
                    continue;
                }

                currentValue.PropertyValue = previousValue.PropertyValue;
            }
        }