예제 #1
0
 /// <summary>
 /// This constructor supports the configuration design-time and is not intended to be used directly from your code.
 /// </summary>
 public MenuCommandService(IUnityContainer builder, AssemblyLocator assemblyLocator, ConfigurationSourceDependency configurationSourceRefresh, Profile profile)
 {
     this.configurationSourceRefresh = configurationSourceRefresh;
     this.profile = profile;
     this.builder = builder;
     this.assemblyLocator = assemblyLocator;
 }
        /// <summary>
        /// Initializes a new instance of <see cref="ApplicationViewModel"/>.
        /// </summary>
        /// <param name="uiService">The <see cref="IUIServiceWpf"/> that should be used to interact with the user.</param>
        /// <param name="sourceModel">The <see cref="ConfigurationSourceModel"/> that should be used to interact with the configuration schema.</param>
        /// <param name="lookup">The <see cref="ElementLookup"/> that should be used to look up <see cref="ElementViewModel"/> instances.</param>
        /// <param name="builder">The <see cref="IUnityContainer"/> instance that should be used to create view model instances with.</param>
        /// <param name="menuCommandService">The <see cref="MenuCommandService"/> that should be used to look up top-level <see cref="CommandModel"/> instances.</param>
        /// <param name="validationModel">The <see cref="ValidationModel"/> that should be used to add validation errors and warnings to.</param>
        /// <param name="profile">The <see cref="Profile"/> that should be used to filter UI elements based on the platform.</param>
        public ApplicationViewModel(IUIServiceWpf uiService, ConfigurationSourceModel sourceModel, ElementLookup lookup,
                                    IUnityContainer builder, MenuCommandService menuCommandService,
                                    ValidationModel validationModel, Profile profile)
        {
            ValidationModel = validationModel;
            this.uiService = uiService;
            this.sourceModel = sourceModel;

            this.lookup = lookup;
            this.builder = builder;
            this.menuCommandService = menuCommandService;
            this.profile = profile;

            NewConfigurationCommand = new DelegateCommand(x => New());
            SaveConfigurationCommand = new DelegateCommand(x => Save());
            SaveAsConfigurationCommand = new DelegateCommand(x => SaveAs());
            OpenConfigurationCommand = new DelegateCommand(x => OpenConfigurationSource());
            ExitCommand = new DelegateCommand(x => Close());

            var environmentCommandsEnabled = this.profile == null ? true : profile.EnvironmentCommandsEnabled;
            OpenEnvironmentCommand = new OpenEnvironmentConfigurationDeltaCommand(uiService, this, environmentCommandsEnabled);
            NewEnvironmentCommand = new DelegateCommand(x => NewEnvironment(), _ => environmentCommandsEnabled);
        }
예제 #3
0
            protected override void Act()
            {
                var serializer = new XmlSerializer(typeof(Profile));

                this.profile = (Profile)serializer.Deserialize(new StringReader(this.document));
            }
 public static void Registration(ConfigurationContainer container, Profile profile)
 {
     container.RegisterType<AssemblyLocator, BinPathProbingAssemblyLocator>(new ContainerControlledLifetimeManager());
     container.RegisterType<ConfigurationSectionLocator, AssemblyAttributeSectionLocator>(new ContainerControlledLifetimeManager());
     container.RegisterType<AnnotationService>(new ContainerControlledLifetimeManager());
     container.RegisterType<ElementLookup>(new ContainerControlledLifetimeManager());
     container.RegisterType<ConfigurationSourceModel>(new ContainerControlledLifetimeManager());
     container.RegisterType<ViewModel.Services.MenuCommandService>(new ContainerControlledLifetimeManager());
     container.RegisterType<ConfigurationSourceDependency>(new ContainerControlledLifetimeManager());
     container.RegisterType<IApplicationModel, ApplicationViewModel>(new ContainerControlledLifetimeManager());
     container.RegisterType<ValidationModel>(new ContainerControlledLifetimeManager());
     container.RegisterType(typeof(IResolver<>), typeof(GenericResolver<>));
     container.RegisterType<SaveOperation>(new ContainerControlledLifetimeManager());
     container.RegisterInstance<IServiceProvider>(container);
     container.RegisterInstance(profile);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigurationContainer"/> class.
 /// </summary>
 /// <param name="serviceProvider">A service provider to resolve services.</param>
 /// <param name="profile">The profile.</param>
 public ConfigurationContainer(IServiceProvider serviceProvider, Profile profile)
 {
     ConfigurationContainerRegistration.Registration(this, profile);
     this.parentServiceProvider = serviceProvider;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigurationContainer"/> class.
 /// </summary>
 /// <param name="profile">The profile.</param>
 public ConfigurationContainer(Profile profile)
     : this(null, profile)
 { }
 /// <summary>
 /// This constructor supports the configuration design-time and is not intended to be used directly from your code.
 /// </summary>
 public DiscoverDerivedConfigurationTypesService(AssemblyLocator assemblyLocator, Profile profile)
 {
     this.assemblyLocator = assemblyLocator;
     this.profile = profile;
 }
        protected override void Arrange()
        {
            base.Arrange();
            var profile = new Profile
            {
                MatchFilters =
                    new MatchFilter[] { new TypeMatchFilter { Name = typeof(CustomTraceListenerData).AssemblyQualifiedName } }
            };

            Container.RegisterInstance(profile);
        }