Exemple #1
0
        public BuilderSettingsManager()
        {
            _coreSettings = new ReadOnlyCollection <IBuilderProperty>(BuilderPropertyHelper.GetAllBuilderProperties());

            BuilderSettings =
                new ObservableCollection <BuilderPropertyViewModel>(
                    _coreSettings.Select(x => new BuilderPropertyViewModel(x)));
            _overwrittenProperties     = new List <BuilderSettingsOverwrite>();
            _externalBuilderProperties = new Dictionary <IPlugin, List <IBuilderProperty> >();
        }
Exemple #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();
        }