Esempio n. 1
0
        private void ApplyOverwrites()
        {
            for (int i = 0; i < _coreSettings.Count; i++)
            {
                var customBuilderProperty = _overwrittenProperties.FirstOrDefault(x => x.PropertyIndex == i);

                var newBuilderProperty = customBuilderProperty != null
                    ? customBuilderProperty.NewBuilderProperty
                    : _coreSettings[i];
                if (BuilderSettings[i].BuilderProperty != newBuilderProperty)
                {
                    BuilderSettings[i] = new BuilderPropertyViewModel(newBuilderProperty)
                    {
                        IsEnabled = customBuilderProperty == null
                    }
                }
                ;
            }
        }
    }
Esempio n. 2
0
        public void InitializeSettings(IList <IBuilderProperty> settings)
        {
            var newSettings = new List <IBuilderProperty>(BuilderPropertyHelper.GetAllBuilderProperties());

            for (int i = 0; i < newSettings.Count; i++)
            {
                var builderProperty     = newSettings[i];
                var builderPropertyType = builderProperty.GetType();
                var existingSetting     = settings.FirstOrDefault(x => x.GetType() == builderPropertyType);

                if (existingSetting != null)
                {
                    newSettings[i] = existingSetting;
                }

                BuilderSettings[i] = new BuilderPropertyViewModel(existingSetting ?? builderProperty);
            }

            _coreSettings = new ReadOnlyCollection <IBuilderProperty>(newSettings);
            ApplyOverwrites();
        }