public SaveMergedEnvironmentConfigurationCommand(IUIServiceWpf uiService, ConfigurationSourceModel configurationSource, IApplicationModel application, ElementViewModel overridesViewModel)
     : base(uiService)
 {
     this.configurationSource = configurationSource;
     this.application = application;
     this.overridesViewModel = (EnvironmentSourceViewModel)overridesViewModel;
 }
        protected override void Arrange()
        {
            base.Arrange();

            ConfigurationSourceBuilder sourceBuilder = new ConfigurationSourceBuilder();

            sourceBuilder.ConfigureLogging().LogToCategoryNamed("General").SendTo.EventLog("Listener").SendTo.Msmq("msmqListener");

            DesignDictionaryConfigurationSource source = new DesignDictionaryConfigurationSource();

            sourceBuilder.UpdateConfigurationWithReplace(source);

            var applicationModel = Container.Resolve <ApplicationViewModel>();
            var sourceModel      = applicationModel.CurrentConfigurationSource;

            sourceModel.Load(source);
            foreach (var element in sourceModel.Sections.SelectMany(x => x.DescendentElements()))
            {
                element.InheritedFromParentConfiguration = false;
            }

            applicationModel.NewEnvironment();
            Environment = applicationModel.Environments.First();

            LoggingSectionViewModel = sourceModel.Sections.Where(x => x.SectionName == LoggingSettings.SectionName).First();
        }
        protected override void Arrange()
        {
            base.Arrange();

            ApplicationViewModel applicationModel = base.Container.Resolve<ApplicationViewModel>();
            applicationModel.ConfigurationFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "main.config");

            overridesModel = (EnvironmentSourceViewModel)SectionViewModel.CreateSection(Container, EnvironmentalOverridesSection.EnvironmentallyOverriddenProperties, new EnvironmentalOverridesSection
            {
                EnvironmentName = "environment"
            });
            overridesModel.EnvironmentDeltaFile = "non_rooted_environment.dconfig";
            targetFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, overridesModel.EnvironmentDeltaFile);
        }
Beispiel #4
0
        protected override void Arrange()
        {
            base.Arrange();

            ApplicationViewModel applicationModel = base.Container.Resolve <ApplicationViewModel>();

            applicationModel.ConfigurationFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "main.config");

            overridesModel = (EnvironmentSourceViewModel)SectionViewModel.CreateSection(Container, EnvironmentalOverridesSection.EnvironmentallyOverriddenProperties, new EnvironmentalOverridesSection
            {
                EnvironmentName = "environment"
            });
            overridesModel.EnvironmentDeltaFile = "non_rooted_environment.dconfig";
            targetFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, overridesModel.EnvironmentDeltaFile);
        }
        public EnvironmentOverriddenElementProperty(IServiceProvider serviceProvider, IUIServiceWpf uiService, EnvironmentSourceViewModel environmentModel, ElementViewModel subject, EnvironmentOverriddenElementPayload overrides)
            : base(serviceProvider, subject, null, new Attribute[]
               {
                   new EnvironmentalOverridesAttribute(false), 
                   new ResourceCategoryAttribute(typeof(DesignResources), "CategoryOverrides")
               })
        {
            this.uiService = uiService;
            this.overrides = overrides;
            this.environment = environmentModel;
            this.converter = new OverriddenElementViewModelConverter();
            this.overrides = overrides;
            this.subject = subject;

            this.environment.PropertyChanged += EnvironmentPropertyChanged;
        }
        public EnvironmentOverriddenProperty(IServiceProvider serviceProvider, EnvironmentOverriddenElementProperty overridesProperty, EnvironmentOverriddenElementPayload overrides, Property originalProperty, EnvironmentSourceViewModel environment)
            : base(serviceProvider, null, originalProperty.DeclaringProperty)
        {
            this.overrides = overrides;
            this.overridesProperty = overridesProperty;
            this.originalProperty = originalProperty;
            this.environment = environment;


            var customOverridesEditorAttribute = originalProperty.Attributes.OfType<EditorAttribute>().Where(x => Type.GetType(x.EditorBaseTypeName) == typeof(IEnvironmentalOverridesEditor)).FirstOrDefault();
            if (customOverridesEditorAttribute != null)
            {
                customOverridesEditorType = Type.GetType(customOverridesEditorAttribute.EditorTypeName, true);
            }

            this.originalProperty.PropertyChanged += OriginalPropertyPropertyChanged;
            this.overridesProperty.PropertyChanged += OverridesPropertyPropertyChanged;
            this.overridesProperty.Subject.PropertyChanged += SubjectPropertyChanged;
        }
Beispiel #7
0
        public EnvironmentOverriddenProperty(IServiceProvider serviceProvider, EnvironmentOverriddenElementProperty overridesProperty, EnvironmentOverriddenElementPayload overrides, Property originalProperty, EnvironmentSourceViewModel environment)
            : base(serviceProvider, null, originalProperty.DeclaringProperty)
        {
            this.overrides         = overrides;
            this.overridesProperty = overridesProperty;
            this.originalProperty  = originalProperty;
            this.environment       = environment;


            var customOverridesEditorAttribute = originalProperty.Attributes.OfType <EditorAttribute>().Where(x => Type.GetType(x.EditorBaseTypeName) == typeof(IEnvironmentalOverridesEditor)).FirstOrDefault();

            if (customOverridesEditorAttribute != null)
            {
                customOverridesEditorType = Type.GetType(customOverridesEditorAttribute.EditorTypeName, true);
            }

            this.originalProperty.PropertyChanged          += OriginalPropertyPropertyChanged;
            this.overridesProperty.PropertyChanged         += OverridesPropertyPropertyChanged;
            this.overridesProperty.Subject.PropertyChanged += SubjectPropertyChanged;
        }
        protected override void Arrange()
        {
            base.Arrange();

            ConfigurationSourceBuilder sourceBuilder = new ConfigurationSourceBuilder();
            sourceBuilder.ConfigureLogging().LogToCategoryNamed("General").SendTo.EventLog("Listener").SendTo.Msmq("msmqListener");

            DesignDictionaryConfigurationSource source = new DesignDictionaryConfigurationSource();
            sourceBuilder.UpdateConfigurationWithReplace(source);

            var applicationModel = Container.Resolve<ApplicationViewModel>();
            var sourceModel = applicationModel.CurrentConfigurationSource;

            sourceModel.Load(source);
            foreach (var element in sourceModel.Sections.SelectMany(x => x.DescendentElements())) element.InheritedFromParentConfiguration = false;

            applicationModel.NewEnvironment();
            Environment = applicationModel.Environments.First();

            LoggingSectionViewModel = sourceModel.Sections.Where(x => x.SectionName == LoggingSettings.SectionName).First();
        }
        protected override void Arrange()
        {
            targetFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("{0}.dconfig", Guid.NewGuid()));

            base.Arrange();

            overridesModel = (EnvironmentSourceViewModel)SectionViewModel.CreateSection(Container, EnvironmentalOverridesSection.EnvironmentallyOverriddenProperties, new EnvironmentalOverridesSection
            {
                EnvironmentName = "environment"
            });

            ApplicationViewModel applicationModel = Container.Resolve<ApplicationViewModel>();
            applicationModel.ConfigurationFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "main.config");


            UIServiceMock.Setup(x => x.ShowFileDialog(It.IsAny<SaveFileDialog>()))
                         .Returns(new FileDialogResult { FileName = targetFile, DialogResult = true })
                         .Verifiable();


        }
        protected override void Arrange()
        {
            targetFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("{0}.dconfig", Guid.NewGuid()));

            base.Arrange();

            overridesModel = (EnvironmentSourceViewModel)SectionViewModel.CreateSection(Container, EnvironmentalOverridesSection.EnvironmentallyOverriddenProperties, new EnvironmentalOverridesSection
            {
                EnvironmentName = "environment"
            });

            ApplicationViewModel applicationModel = Container.Resolve <ApplicationViewModel>();

            applicationModel.ConfigurationFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "main.config");


            UIServiceMock.Setup(x => x.ShowFileDialog(It.IsAny <SaveFileDialog>()))
            .Returns(new FileDialogResult {
                FileName = targetFile, DialogResult = true
            })
            .Verifiable();
        }
 /// <summary>
 /// Removes a Configuration Environment from the application.
 /// </summary>
 /// <param name="environment">The <see cref="EnvironmentSourceViewModel"/> that should be removed.</param>
 public void RemoveEnvironment(EnvironmentSourceViewModel environment)
 {
     lookup.RemoveSection(environment);
     environments.Remove(environment);
 }
 /// <summary>
 /// initializes a new instance of <see cref="FrameworkEditorBindableProperty"/>.
 /// </summary>
 /// <param name="property">The underlying <see cref="Property"/> instance.</param>
 /// <param name="frameworkElementEditorType">The type of the control that should be used to edit the underlying <see cref="Property"/>. This type must derive from <see cref="FrameworkElement"/>.</param>
 /// <param name="environment">The environment for which this the editor should be initialized.</param>
 public EnvironmentAwareFrameworkEditorBindableProperty(Property property, Type frameworkElementEditorType, EnvironmentSourceViewModel environment)
     : base(property, frameworkElementEditorType)
 {
     this.environment = environment;
     this.frameworkElementEditorType = frameworkElementEditorType;
 }
 /// <summary>
 /// initializes a new instance of <see cref="FrameworkEditorBindableProperty"/>.
 /// </summary>
 /// <param name="property">The underlying <see cref="Property"/> instance.</param>
 /// <param name="frameworkElementEditorType">The type of the control that should be used to edit the underlying <see cref="Property"/>. This type must derive from <see cref="FrameworkElement"/>.</param>
 /// <param name="environment">The environment for which this the editor should be initialized.</param>
 public EnvironmentAwareFrameworkEditorBindableProperty(Property property, Type frameworkElementEditorType, EnvironmentSourceViewModel environment)
     : base(property, frameworkElementEditorType)
 {
     this.environment = environment;
     this.frameworkElementEditorType = frameworkElementEditorType;
 }
 public EnvironmentalTraceListenerReferenceDataViewModel(TraceListenerReferenceViewModel original, EnvironmentSourceViewModel environment)
 {
     this.original = original;
     this.environment = environment;
 }
 public void Initialize(EnvironmentSourceViewModel environment)
 {
     this.environment = environment;
 }
        public TraceListenerReferenceEnvironmentOverriddenElementProperty (IServiceProvider serviceProvider, IUIServiceWpf uiService, EnvironmentSourceViewModel environmentModel, ElementViewModel subject, EnvironmentOverriddenElementPayload overrides)
            : base(serviceProvider, uiService, environmentModel, subject, overrides)
	    {

	    }
 public SaveEnvironmentConfigurationDeltaCommand(IUIServiceWpf uiService, ElementViewModel overridesViewModel)
     : base(uiService)
 {
     this.overridesViewModel = (EnvironmentSourceViewModel)overridesViewModel;
 }
Beispiel #18
0
 /// <summary>
 /// Removes a Configuration Environment from the application.
 /// </summary>
 /// <param name="environment">The <see cref="EnvironmentSourceViewModel"/> that should be removed.</param>
 public void RemoveEnvironment(EnvironmentSourceViewModel environment)
 {
     lookup.RemoveSection(environment);
     environments.Remove(environment);
 }
 public Property GetNameProperty(EnvironmentSourceViewModel environment)
 {
     var overridesProperty = this.Properties.OfType<EnvironmentOverriddenElementProperty>().Where(x => x.Environment == environment).FirstOrDefault();
     return overridesProperty.ChildProperties.Where(x => x.PropertyName == "Name").FirstOrDefault();
 }