protected override void Act()
        {
            var configurationSourceModel = Container.Resolve <ConfigurationSourceModel>();

            ehabModel = configurationSourceModel.AddSection(ExceptionHandlingSettings.SectionName, base.Section);
            lookup    = Container.Resolve <ElementLookup>();
        }
 public OverriddenElementViewModel(ElementLookup lookup, EnvironmentMergeSection environmentSection, ElementViewModel subject)
 {
     this.lookup = lookup;
     this.environmentSection = environmentSection;
     this.elementReference = new ReferenceContainer(this);
     this.subject = subject;
 }
 ///<summary>
 /// Initializes a new instance of <see cref="ValidationModel"/>.
 ///</summary>
 ///<param name="lookup">The element loookup service to use for monitoring the addition and removal of <see cref="ElementViewModel"/> items.</param>
 public ValidationModel(ElementLookup lookup)
 {
     this.lookup = lookup;
     this.navigateValidationResultCommand = new NavigateValidationResultCommand(this);
     ResetCollection();
     lookup.CollectionChanged += ElementsChanged;
 }
Esempio n. 4
0
        public void then_element_extended_property_provider_can_be_found()
        {
            ElementLookup lookup             = (ElementLookup)Container.Resolve <ElementLookup>();
            var           extensionProviders = lookup.FindExtendedPropertyProviders();

            Assert.IsTrue(extensionProviders.Count() > 0);
        }
Esempio n. 5
0
 ///<summary>
 /// Initializes a new instance of <see cref="ValidationModel"/>.
 ///</summary>
 ///<param name="lookup">The element loookup service to use for monitoring the addition and removal of <see cref="ElementViewModel"/> items.</param>
 public ValidationModel(ElementLookup lookup)
 {
     this.lookup = lookup;
     this.navigateValidationResultCommand = new NavigateValidationResultCommand(this);
     ResetCollection();
     lookup.CollectionChanged += ElementsChanged;
 }
        ///<summary>
        /// Initializes a new instance of <see cref="SelectDatabaseStep"/>.
        ///</summary>
        ///<param name="serviceProvider">The service provider to use for service location.</param>
        ///<param name="sourceModel">The <see cref="ConfigurationSourceModel"/> to update on <see cref="WizardStep.Execute"/></param>
        ///<param name="validatorFactory">The factory creating new <see cref="Validator"/> instances.</param>
        ///<param name="elementLookup">The service for locating registered elements.</param>
        public SelectDatabaseStep(IServiceProvider serviceProvider,
                                ConfigurationSourceModel sourceModel,
                                IResolver<Validator> validatorFactory,
                                ElementLookup elementLookup
                                )
            : base(serviceProvider, validatorFactory, elementLookup)
        {
            this.sourceModel = sourceModel;

            var name = AddReflectedProperty(wizardData, propertyName);

            PropertyList.Add(new AssociatedWizardProperty(serviceProvider,
                                                          wizardData,
                                                          TypeDescriptor.GetProperties(wizardData)[propertyConnectionString],
                                                          validatorFactory,
                                                          elementLookup,
                                                          name));

            
            PropertyList.Add(new AssociatedWizardProperty(serviceProvider,
                                                          wizardData,
                                                          TypeDescriptor.GetProperties(wizardData)[propertyProviderName],
                                                          validatorFactory,
                                                          elementLookup,
                                                          name));

            SetDefaultDatabase(elementLookup);
        }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AddSatelliteProviderCommand"/> class.
 /// </summary>
 /// <remarks>
 /// This class is intended to be initialized by the <see cref="SectionViewModel.CreateElementCollectionAddCommands"/>.
 /// </remarks>
 /// <param name="commandAttribute">The <see cref="AddSateliteProviderCommandAttribute"/> that specifes metadata for this <see cref="AddSatelliteProviderCommand"/> to be initialized with.</param>
 /// <param name="collection"></param>
 /// <param name="commandService"></param>
 /// <param name="configurationElementType"></param>
 /// <param name="lookup"></param>
 /// <param name="uiService"></param>
 public AddSatelliteProviderCommand(AddSateliteProviderCommandAttribute commandAttribute, MenuCommandService commandService, ConfigurationElementType configurationElementType, ElementCollectionViewModel collection, ElementLookup lookup, IUIServiceWpf uiService)
     : base(commandAttribute, configurationElementType, collection, uiService)
 {
     this.commandService   = commandService;
     this.commandAttribute = commandAttribute;
     this.lookup           = lookup;
 }
Esempio n. 8
0
        ///<summary>
        /// Initializes a new instance of <see cref="SelectDatabaseStep"/>.
        ///</summary>
        ///<param name="serviceProvider">The service provider to use for service location.</param>
        ///<param name="sourceModel">The <see cref="ConfigurationSourceModel"/> to update on <see cref="WizardStep.Execute"/></param>
        ///<param name="validatorFactory">The factory creating new <see cref="Validator"/> instances.</param>
        ///<param name="elementLookup">The service for locating registered elements.</param>
        public SelectDatabaseStep(IServiceProvider serviceProvider,
                                  ConfigurationSourceModel sourceModel,
                                  IResolver <Validator> validatorFactory,
                                  ElementLookup elementLookup
                                  )
            : base(serviceProvider, validatorFactory, elementLookup)
        {
            this.sourceModel = sourceModel;

            var name = AddReflectedProperty(wizardData, propertyName);

            PropertyList.Add(new AssociatedWizardProperty(serviceProvider,
                                                          wizardData,
                                                          TypeDescriptor.GetProperties(wizardData)[propertyConnectionString],
                                                          validatorFactory,
                                                          elementLookup,
                                                          name));


            PropertyList.Add(new AssociatedWizardProperty(serviceProvider,
                                                          wizardData,
                                                          TypeDescriptor.GetProperties(wizardData)[propertyProviderName],
                                                          validatorFactory,
                                                          elementLookup,
                                                          name));

            SetDefaultDatabase(elementLookup);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddSatelliteProviderCommand"/> class.
 /// </summary>
 /// <remarks>
 /// This class is intended to be initialized by the <see cref="SectionViewModel.CreateElementCollectionAddCommands"/>.
 /// </remarks>
 /// <param name="commandAttribute">The <see cref="AddSateliteProviderCommandAttribute"/> that specifes metadata for this <see cref="AddSatelliteProviderCommand"/> to be initialized with.</param>
 /// <param name="collection"></param>
 /// <param name="commandService"></param>
 /// <param name="configurationElementType"></param>
 /// <param name="lookup"></param>
 /// <param name="uiService"></param>
 public AddSatelliteProviderCommand(AddSateliteProviderCommandAttribute commandAttribute, MenuCommandService commandService, ConfigurationElementType configurationElementType, ElementCollectionViewModel collection, ElementLookup lookup, IUIServiceWpf uiService)
     : base(commandAttribute, configurationElementType, collection, uiService)
 {
     this.commandService = commandService;
     this.commandAttribute = commandAttribute;
     this.lookup = lookup;
 }
 public OverriddenElementViewModel(ElementLookup lookup, EnvironmentMergeSection environmentSection, EnvironmentNodeMergeElement mergeElement)
 {
     this.lookup = lookup;
     this.environmentSection = environmentSection;
     this.mergeElement = mergeElement;
     this.elementReference = new ReferenceContainer(this);
     this.elementReference.InitializeReference(mergeElement.ConfigurationNodePath, mergeElement);
 }
Esempio n. 11
0
 public OverriddenElementViewModel(ElementLookup lookup, EnvironmentMergeSection environmentSection, EnvironmentNodeMergeElement mergeElement)
 {
     this.lookup             = lookup;
     this.environmentSection = environmentSection;
     this.mergeElement       = mergeElement;
     this.elementReference   = new ReferenceContainer(this);
     this.elementReference.InitializeReference(mergeElement.ConfigurationNodePath, mergeElement);
 }
        public void then_contained_elements_are_removed_in_lookup()
        {
            ElementLookup lookup = Container.Resolve <ElementLookup>();

            foreach (var containedElement in removedElement.DescendentElements())
            {
                Assert.IsFalse(lookup.FindInstancesOfConfigurationType(containedElement.ConfigurationType).Where(x => x.Path == containedElement.Path).Any());
            }
        }
Esempio n. 13
0
            public ExtendedPropertyContainer(ElementLookup lookup, ElementViewModel subject,
                                             ObservableCollection <Property> properties)
            {
                this.properties           = properties;
                this.subject              = subject;
                extendedPropetryProviders = lookup.FindExtendedPropertyProviders();
                extendedPropetryProviders.CollectionChanged += extendedPropetryProviders_CollectionChanged;

                Refresh();
            }
 /// <summary>
 /// Initializes a new <see cref="ConfigurationSourceModel"/>.
 /// </summary>
 /// <param name="lookup">The <see cref="ElementLookup"/> service used for locating elements.</param>
 /// <param name="viewModelDependency">The <see cref="ConfigurationSourceDependency"/> for notifying others of changes in this configuration source.</param>
 /// <param name="builder">The container for building new objects.</param>
 /// <param name="uiService">The user-interface service for presenting dialogs and windows to the user.</param>
 /// <param name="saveOperation">Save operation integration with a host environment.</param>
 public ConfigurationSourceModel(ElementLookup lookup, ConfigurationSourceDependency viewModelDependency, IUnityContainer builder, IUIServiceWpf uiService, SaveOperation saveOperation)
 {
     this.uiService = uiService;
     this.builder = builder;
     this.viewModelDependency = viewModelDependency;
     this.lookup = lookup;
     this.saveOperation = saveOperation;
     sections = new ObservableCollection<SectionViewModel>();
     readOnlySectionView = new ReadOnlyObservableCollection<SectionViewModel>(sections);
 }
Esempio n. 15
0
        public void then_reference_can_be_fixed_by_loading_section()
        {
            ElementLookup elementLookup = Container.Resolve<ElementLookup>();
            var reference = elementLookup.CreateReference("/configuration/" + ExceptionHandlingSettings.SectionName);

            var sourceModel = Container.Resolve<ConfigurationSourceModel>();
            sourceModel.AddSection(ExceptionHandlingSettings.SectionName, base.Section);

            Assert.IsNotNull(reference.Element);
        }
Esempio n. 16
0
 /// <summary>
 /// Initializes a new <see cref="ConfigurationSourceModel"/>.
 /// </summary>
 /// <param name="lookup">The <see cref="ElementLookup"/> service used for locating elements.</param>
 /// <param name="viewModelDependency">The <see cref="ConfigurationSourceDependency"/> for notifying others of changes in this configuration source.</param>
 /// <param name="builder">The container for building new objects.</param>
 /// <param name="uiService">The user-interface service for presenting dialogs and windows to the user.</param>
 /// <param name="saveOperation">Save operation integration with a host environment.</param>
 public ConfigurationSourceModel(ElementLookup lookup, ConfigurationSourceDependency viewModelDependency, IUnityContainer builder, IUIServiceWpf uiService, SaveOperation saveOperation)
 {
     this.uiService           = uiService;
     this.builder             = builder;
     this.viewModelDependency = viewModelDependency;
     this.lookup         = lookup;
     this.saveOperation  = saveOperation;
     sections            = new ObservableCollection <SectionViewModel>();
     readOnlySectionView = new ReadOnlyObservableCollection <SectionViewModel>(sections);
 }
 /// <summary>
 /// Creates a new <see cref="ConfigurationWizardStep"/>.
 /// </summary>
 /// <param name="serviceProvider"></param>
 /// <param name="validatorFactory">A factory for creating <see cref="Validator"/> instances.</param>
 /// <param name="elementLookup">A service for locating elements within the current <see cref="ApplicationViewModel"/>.</param>
 protected ConfigurationWizardStep(
     IServiceProvider serviceProvider,
     IResolver <Validator> validatorFactory,
     ElementLookup elementLookup)
 {
     this.serviceProvider  = serviceProvider;
     this.validatorFactory = validatorFactory;
     this.elementLookup    = elementLookup;
     propertyList          = new WizardStepPropertyCollection(this);
 }
        /// <summary>
        /// Initializes an instance of <see cref="PickExceptionStep"/>.
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <param name="sourceModel"></param>
        /// <param name="validatorFactory"></param>
        /// <param name="elementLookup"></param>
        public PickExceptionStep(IServiceProvider serviceProvider,
                                 ConfigurationSourceModel sourceModel,
                                 IResolver <Validator> validatorFactory,
                                 ElementLookup elementLookup
                                 ) : base(serviceProvider, validatorFactory, elementLookup)
        {
            this.sourceModel = sourceModel;

            AddReflectedProperty(wizardData, propertyExceptionType);
            AddReflectedProperty(wizardData, propertyPolicy);
        }
        /// <summary>
        /// Initializes an instance of <see cref="PickExceptionStep"/>.
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <param name="sourceModel"></param>
        /// <param name="validatorFactory"></param>
        /// <param name="elementLookup"></param>
        public PickExceptionStep(IServiceProvider serviceProvider,
                                ConfigurationSourceModel sourceModel,
                                IResolver<Validator> validatorFactory,
                                ElementLookup elementLookup
                                ) : base(serviceProvider, validatorFactory, elementLookup)
        {
            this.sourceModel = sourceModel;

            AddReflectedProperty(wizardData, propertyExceptionType);
            AddReflectedProperty(wizardData, propertyPolicy);
        }
 public WizardProperty(IServiceProvider serviceProvider,
                       object component,
                       PropertyDescriptor declaringProperty,
                       IResolver <Validator> validatorResolver,
                       ElementLookup elementLookup,
                       params Attribute[] additionalAttributes
                       )
     : base(serviceProvider, component, declaringProperty, additionalAttributes)
 {
     this.validatorResolver = validatorResolver;
     this.elementLookup     = elementLookup;
 }
 public WizardProperty(IServiceProvider serviceProvider, 
     object component, 
     PropertyDescriptor declaringProperty, 
     IResolver<Validator> validatorResolver,
     ElementLookup elementLookup,
     params Attribute[] additionalAttributes
     )
     : base(serviceProvider, component, declaringProperty, additionalAttributes)
 {
     this.validatorResolver = validatorResolver;
     this.elementLookup = elementLookup;
 }
        protected override void Arrange()
        {
            base.Arrange();

            exceptionHandlingViewModel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, base.ExceptionSettings);

            ElementLookup lookup = Container.Resolve <ElementLookup>();

            changeScopeForHandlers = lookup.CreateChangeScope(x => typeof(ExceptionHandlerData).IsAssignableFrom(x.ConfigurationType));

            changeScopeForHandlers.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(changeScopeForHandlers_CollectionChanged);
        }
Esempio n. 23
0
        public void AddElement_addsElementToElementList()
        {
            var elementLookup = new ElementLookup
            {
                PageName = "TestPage",
                Alias    = "TestElement",
                Id       = "testElement"
            };

            _seleniumBrowser.AddElement(elementLookup);

            Assert.AreEqual(1, _seleniumBrowser.GetElements.Count);
        }
        ///<summary>
        /// Initializes an instance of the ElementReferenceProperty.  This is usually created by the <see cref="SectionViewModel"/>.
        ///</summary>
        ///<param name="serviceProvider">The service provide used within the Enterprise Library configuration system.</param>
        ///<param name="lookup">The element lookup registry.</param>
        ///<param name="parent">The <see cref="ElementViewModel"/> on which this property is attached.</param>
        ///<param name="declaringProperty">The descriptor declaring this property.</param>
        ///<param name="additionalAttributes">Additional attributes to apply to the reference proeprty.</param>
        ///<exception cref="ArgumentException">Thrown if the declaring property <see cref="PropertyDescriptor.PropertyType"/> is not a <see cref="string"/> type.</exception>
        public ElementReferenceProperty(IServiceProvider serviceProvider, ElementLookup lookup, ElementViewModel parent, PropertyDescriptor declaringProperty, IEnumerable<Attribute> additionalAttributes)
            : base(serviceProvider, parent, declaringProperty, additionalAttributes.Union(new Attribute[]{new ValidationAttribute(typeof(ElementReferenceValidator))}))
        {
            if (declaringProperty.PropertyType != typeof(string)) throw new ArgumentException(Resources.ReferencePropertyInvalidType);

            this.lookup = lookup;
            this.changeScopePropertyWatcher = new ChangeScopePropertyWatcher();
            this.changeScopePropertyWatcher.ChangeScopePropertyChanged += new EventHandler(ChangeScopePropertyWatcherChangeScopePropertyChanged);

            referenceAttribute = base.Attributes.OfType<ReferenceAttribute>().FirstOrDefault();
            Debug.Assert(referenceAttribute != null);

            ((INotifyCollectionChanged)ValidationResults).CollectionChanged += ValidationCollectionChanged;
        }
Esempio n. 25
0
        public void then_reference_signals_event_if_reference_is_fixed()
        {
            bool elementFoundSignalled = false;

            ElementLookup elementLookup = Container.Resolve<ElementLookup>();
            var reference = elementLookup.CreateReference("/configuration/" + ExceptionHandlingSettings.SectionName);

            reference.ElementFound += (s, a) => elementFoundSignalled = true;

            var sourceModel = Container.Resolve<ConfigurationSourceModel>();
            sourceModel.AddSection(ExceptionHandlingSettings.SectionName, base.Section);

            Assert.IsTrue(elementFoundSignalled);
        }
        /// <summary>
        /// Creates an instance of <see cref="AssociatedWizardProperty"/>.
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <param name="component"></param>
        /// <param name="declaringProperty"></param>
        /// <param name="validatorResolver"></param>
        /// <param name="elementLookup"></param>
        /// <param name="associatedProperty"></param>
        /// <param name="additionalAttributes"></param>
        public AssociatedWizardProperty(
            IServiceProvider serviceProvider,
            object component,
            PropertyDescriptor declaringProperty,
            IResolver <Validator> validatorResolver,
            ElementLookup elementLookup,
            WizardProperty associatedProperty,
            params Attribute[] additionalAttributes)
            : base(serviceProvider, component, declaringProperty, validatorResolver, elementLookup, additionalAttributes)
        {
            this.associatedProperty = associatedProperty;

            associatedProperty.PropertyChanged += AssociatedPropertyChangedHandler;
        }
Esempio n. 27
0
        public static List <CPOSummaryHead> GetChangeList(User user)
        {
            List <CPOSummaryHead> ret        = new List <CPOSummaryHead>();
            DBConnect             connection = new DBConnect();

            try
            {
                connection.Connect(ConnectionsMgr.GetSHConnInfo(user, _Database.ECGB));
                var queryCPOHead = connection.Select(new[] { _Column.UniqueKey, _Column.PONumber, _Column.POChangeDate, _Column.Purpose, _Column.TotalItems, _Column.HProcessed }, _Table.Head860, string.Format("WHERE {0}='{1}' AND {2}='{3}' AND ({4}='{5}' OR {4}='{6}')", _Column.Customer, user.Customer, _Column.Partner, user.ActivePartner, _Column.HProcessed, _ProgressFlag.Unprocessed, _ProgressFlag.Error));

                while (queryCPOHead.Read())
                {
                    CPOSummaryHead newHead = new CPOSummaryHead();
                    newHead.UniqueKey    = queryCPOHead.Field(0, "");
                    newHead.PONumber     = queryCPOHead.Field(1, "");
                    newHead.POChangeDate = queryCPOHead.Field(2, "");
                    newHead.Purpose      = ElementLookup.GetDesc(user, _Element.Purpose, queryCPOHead.Field(3, ""));
                    newHead.Affected     = queryCPOHead.Field(4, "");
                    newHead.Status       = queryCPOHead.Field(5, "");
                    newHead.Details      = new List <CPOSummaryDetail>();
                    var queryCPODetail = connection.Select(new[] { _Column.ChangeType, _Column.Quantity, _Column.ChangeQuantity, _Column.UnitPrice, _Column.RetailPrice, _Column.UPCNum, _Column.VendorNum, _Column.ItemDesc, _Column.PackSize, _Column.Dropship, _Column.Processed }, _Table.Detail860, string.Format("WHERE {0}='{1}'", _Column.UniqueKey, newHead.UniqueKey));
                    while (queryCPODetail.Read())
                    {
                        CPOSummaryDetail newDetail = new CPOSummaryDetail();
                        newDetail.ChangeType     = ElementLookup.GetDesc(user, _Element.ChangeType, queryCPODetail.Field(0, ""));
                        newDetail.Quantity       = decimal.Parse(queryCPODetail.Field(1, "0")).ToString("N0");
                        newDetail.ChangeQuantity = decimal.Parse(queryCPODetail.Field(2, "0")).ToString("N0");
                        newDetail.UnitPrice      = queryCPODetail.Field(3, "");
                        newDetail.RetailPrc      = queryCPODetail.Field(4, "");
                        newDetail.UPC            = queryCPODetail.Field(5, "");
                        newDetail.VendorNum      = queryCPODetail.Field(6, "");
                        newDetail.ItemDesc       = queryCPODetail.Field(7, "");
                        newDetail.PackSize       = queryCPODetail.Field(8, "");
                        newDetail.Dropship       = queryCPODetail.Field(9, "").Replace('\r', ' ');
                        newDetail.Status         = queryCPODetail.Field(10, "");
                        newHead.Details.Add(newDetail);
                    }
                    ret.Add(newHead);
                }
                return(ret.OrderBy(h => h.POChangeDate).ThenBy(h => h.PONumber).ThenBy(h => h.Purpose).ToList());
            }
            catch (Exception e)
            {
                connection.Close();
                ProgramLog.LogError(user, "ChangePOTracker", "GetChangeList", e.Message);
                return(new List <CPOSummaryHead>());
            }
        }
        protected override void Arrange()
        {
            base.Arrange();

            exceptionHandlingViewModel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, base.ExceptionSettings);

            ElementLookup lookup = Container.Resolve <ElementLookup>();

            lookup.AddSection(exceptionHandlingViewModel);

            changeScopeForHandlers = lookup.CreateChangeScope(x => typeof(ExceptionHandlerData).IsAssignableFrom(x.ConfigurationType));
            changeScopeForHandlers.CollectionChanged += changeScopeForHandler;

            neverFiringChangeScope = lookup.CreateChangeScope(x => true == false);
            neverFiringChangeScope.CollectionChanged += shouldNeverFireCollectionChanged;
        }
Esempio n. 29
0
        public ElementReferenceProperty(IServiceProvider serviceProvider, ElementLookup lookup, ElementViewModel parent, PropertyDescriptor declaringProperty, IEnumerable <Attribute> additionalAttributes)
            : base(serviceProvider, parent, declaringProperty, additionalAttributes.Union(new Attribute[] { new ValidationAttribute(typeof(ElementReferenceValidator)) }))
        {
            if (declaringProperty.PropertyType != typeof(string))
            {
                throw new ArgumentException(Resources.ReferencePropertyInvalidType);
            }

            this.lookup = lookup;
            this.changeScopePropertyWatcher = new ChangeScopePropertyWatcher();
            this.changeScopePropertyWatcher.ChangeScopePropertyChanged += new EventHandler(ChangeScopePropertyWatcherChangeScopePropertyChanged);

            referenceAttribute = base.Attributes.OfType <ReferenceAttribute>().FirstOrDefault();
            Debug.Assert(referenceAttribute != null);

            ((INotifyCollectionChanged)ValidationResults).CollectionChanged += ValidationCollectionChanged;
        }
Esempio n. 30
0
        public EnvironmentSourceViewModel(IUnityContainer builder, IUIServiceWpf uiService, ApplicationViewModel sourceModel, ConfigurationSection section)
            : base(builder, EnvironmentalOverridesSection.EnvironmentallyOverriddenProperties, section, new Attribute[] { new EnvironmentalOverridesAttribute(false) })
        {
            this.uiService          = uiService;
            this.environmentSection = (EnvironmentalOverridesSection)section;
            this.elementLookup      = builder.Resolve <ElementLookup>();
            this.applicationModel   = sourceModel;

            foreach (EnvironmentalOverridesElement mergeElement in environmentSection.MergeElements)
            {
                var payload   = new EnvironmentOverriddenElementPayload(environmentSection, mergeElement.LogicalParentElementPath);
                var reference = new EnvironmentOverriddenElementReference(elementLookup, environmentSection);
                reference.InitializeWithConfigurationElementPayload(payload);

                overriddenElements.Add(reference);
            }

            saveMergedConfigurationCommand = CreateCommand <SaveMergedEnvironmentConfigurationCommand>(this);
            saveEnvironmentDeltaCommand    = CreateCommand <SaveEnvironmentConfigurationDeltaCommand>(this);
        }
Esempio n. 31
0
        private void SetDefaultDatabase(ElementLookup elementLookUp)
        {
            var element = elementLookUp.FindInstancesOfConfigurationType(typeof(DatabaseSettings)).FirstOrDefault();

            if (element == null)
            {
                return;
            }

            var elementProperty = element.Properties.FirstOrDefault(p => p.PropertyName == "DefaultDatabase");

            if (elementProperty == null)
            {
                return;
            }

            if (elementProperty.Value != null)
            {
                Name.Value = elementProperty.Value;
            }
        }
Esempio n. 32
0
        /// <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>
        public ApplicationViewModel(IUIServiceWpf uiService, ConfigurationSourceModel sourceModel, ElementLookup lookup,
                                    IUnityContainer builder, MenuCommandService menuCommandService,
                                    ValidationModel validationModel)
        {
            ValidationModel  = validationModel;
            this.uiService   = uiService;
            this.sourceModel = sourceModel;

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

            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());

            OpenEnvironmentCommand = new OpenEnvironmentConfigurationDeltaCommand(uiService, this);
            NewEnvironmentCommand  = new DelegateCommand(x => NewEnvironment());
        }
Esempio n. 33
0
            public DeferredElementScope(ReferenceAttribute referenceAttribute,
                                        ElementViewModel baseDeclaringElement,
                                        ElementLookup lookup)
            {
                this.referenceAttribute = referenceAttribute;
                this.lookup             = lookup;

                if (referenceAttribute.ScopeIsDeclaringElement)
                {
                    CreateElementScope(baseDeclaringElement);
                }
                else
                {
                    if (!TryCreateScopeElement())
                    {
                        scopeChangeScope =
                            lookup.CreateChangeScope(x => x.ConfigurationType.IsAssignableFrom(referenceAttribute.ScopeType));
                        scopeChangeScope.CollectionChanged += ScopeChangedHandler;
                    }
                }
            }
Esempio n. 34
0
        /// <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>
        public ApplicationViewModel(IUIServiceWpf uiService, ConfigurationSourceModel sourceModel, ElementLookup lookup,
                                    IUnityContainer builder, MenuCommandService menuCommandService,
                                    ValidationModel validationModel)
        {
            ValidationModel = validationModel;
            this.uiService = uiService;
            this.sourceModel = sourceModel;
            
            this.lookup = lookup;
            this.builder = builder;
            this.menuCommandService = menuCommandService;

            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());

            OpenEnvironmentCommand = new OpenEnvironmentConfigurationDeltaCommand(uiService, this);
            NewEnvironmentCommand = new DelegateCommand(x => NewEnvironment());
        }
        private void SetDefaultDatabase(ElementLookup elementLookUp)
        {
            var element = elementLookUp.FindInstancesOfConfigurationType(typeof(DatabaseSettings)).FirstOrDefault();

            if (element == null)
            {
                return;
            }

            var elementProperty = element.Properties.FirstOrDefault(p => p.PropertyName == "DefaultDatabase");

            if (elementProperty == null)
            {
                return;
            }

            if (elementProperty.Value != null)
            {
                Name.Value = elementProperty.Value;
            }
        }
        /// <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);
        }
        /// <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);
        }
 public CollectionEditorContainedElementReferenceProperty(IServiceProvider serviceProvider, ElementLookup lookup, ElementViewModel parent, PropertyDescriptor declaringProperty)
     : base(serviceProvider, lookup, parent, declaringProperty)
 {
     logicalParentElement = parent.ParentElement.ParentElement;
 }
 public EnvironmentOverriddenElementReference(ElementLookup lookup, EnvironmentalOverridesSection environmentSourceModel)
 {
     this.lookup = lookup;
     this.environmentSourceModel = environmentSourceModel;
 }
 public ElementReferenceProperty(IServiceProvider serviceProvider, ElementLookup lookup, ElementViewModel parent, PropertyDescriptor declaringProperty)
     : this(serviceProvider, lookup, parent, declaringProperty, Enumerable.Empty<Attribute>())
 {
 }
 public CustomTraceListenerFormatterProperty(IServiceProvider serviceProvider, ElementLookup lookup, ElementViewModel parent, PropertyDescriptor declaringProperty)
     : base(serviceProvider, lookup, parent, declaringProperty, new Attribute[] { new ConfigurationPropertyAttribute("formatter") })
 {
 }
Esempio n. 42
0
 public void AddElement(ElementLookup element)
 {
     Elements.Add(element);
 }
 public DataSectionViewModel(IUnityContainer builder, string sectionName, ConfigurationSection section)
     : base(builder, sectionName, section)
 {
     this.builder = builder;
     elementLookup = builder.Resolve<ElementLookup>();
 }
 public ValidationSectionViewModel(IUnityContainer builder, string sectionName, ConfigurationSection section, ElementLookup lookup)
     : base(builder, sectionName, section)
 {
     changeScope = lookup.CreateChangeScope(e => e.ContainingSection == this && typeof(ValidatorData).IsAssignableFrom(e.ConfigurationType));
 }
        public UnitySectionViewModel(IUnityContainer builder, string sectionName, ConfigurationSection section, ElementLookup lookup)
            : base(builder, sectionName, section)
        {
            this.lookup = lookup;

        }
 public CacheManagerBackingStoreProperty(IServiceProvider serviceProvider, ElementLookup elementLookup, ElementViewModel parent, PropertyDescriptor declaringProperty)
     : base(serviceProvider, elementLookup, parent, declaringProperty)
 {
     
 }
 public CustomTraceListenerFormatterProperty(IServiceProvider serviceProvider, ElementLookup lookup, ElementViewModel parent, PropertyDescriptor declaringProperty)
     : base(serviceProvider, lookup, parent, declaringProperty, new Attribute[] { new ConfigurationPropertyAttribute("formatter") })
 {
 }
 public ValidationSectionViewModel(IUnityContainer builder, string sectionName, ConfigurationSection section, ElementLookup lookup)
     : base(builder, sectionName, section)
 {
     changeScope = lookup.CreateChangeScope(e => e.ContainingSection == this && typeof(ValidatorData).IsAssignableFrom(e.ConfigurationType));
 }
 protected override void Act()
 {
     var configurationSourceModel = Container.Resolve<ConfigurationSourceModel>();
     viewModel = configurationSourceModel.AddSection(ExceptionHandlingSettings.SectionName, Section);
     lookup = Container.Resolve<ElementLookup>();
 }
            public DeferredElementScope(ReferenceAttribute referenceAttribute,
                                        ElementViewModel baseDeclaringElement,
                                        ElementLookup lookup)
            {
                this.referenceAttribute = referenceAttribute;
                this.lookup = lookup;

                if (referenceAttribute.ScopeIsDeclaringElement)
                {
                    CreateElementScope(baseDeclaringElement);
                }
                else
                {
                    if (!TryCreateScopeElement())
                    {
                        scopeChangeScope =
                            lookup.CreateChangeScope(x => x.ConfigurationType.IsAssignableFrom(referenceAttribute.ScopeType));
                        scopeChangeScope.CollectionChanged += ScopeChangedHandler;
                    }
                }
            }
 public CacheManagerBackingStoreProperty(IServiceProvider serviceProvider, ElementLookup elementLookup, ElementViewModel parent, PropertyDescriptor declaringProperty)
     : base(serviceProvider, elementLookup, parent, declaringProperty)
 {
 }
 public RedirectedSectionSourceProperty(IServiceProvider serviceProvider, ElementLookup lookup, ElementViewModel parent, PropertyDescriptor declaringProperty)
     : base(serviceProvider, lookup, parent, declaringProperty)
 {
 }
        /// <summary>
        /// Creates an instance of <see cref="AssociatedWizardProperty"/>.
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <param name="component"></param>
        /// <param name="declaringProperty"></param>
        /// <param name="validatorResolver"></param>
        /// <param name="elementLookup"></param>
        /// <param name="associatedProperty"></param>
        /// <param name="additionalAttributes"></param>
        public AssociatedWizardProperty(
            IServiceProvider serviceProvider, 
            object component, 
            PropertyDescriptor declaringProperty, 
            IResolver<Validator> validatorResolver, 
            ElementLookup elementLookup,
            WizardProperty associatedProperty,
            params Attribute[] additionalAttributes) 
            : base(serviceProvider, component, declaringProperty, validatorResolver, elementLookup, additionalAttributes)
        {
            this.associatedProperty = associatedProperty;

            associatedProperty.PropertyChanged += AssociatedPropertyChangedHandler;
        }
 private static ElementLookup CreateLookup(Type t)
 {
     return(ElementLookup.CreateLookup(t, type => () => (OpenXmlElement)Activator.CreateInstance(type)));
 }
 public ConnectionStringSettingsDefaultDatabaseElementProperty(IServiceProvider serviceProvider, ElementLookup lookup, ElementViewModel parent, PropertyDescriptor declaringProperty)
     :base(serviceProvider, lookup, parent, declaringProperty, new Attribute[]{new ValidationAttribute(typeof(DefaultDatabaseValidator))})
 {
 
 }