private void ReCreatePropertyWatchers(IElementChangeScope elementChangeScope)
 {
     ClearPropertyWatchers();
     foreach (var property in elementChangeScope.SelectMany(x => x.Properties))
     {
         propertyWatchers.Add(new WatchForValuePropertyChanges(property, action));
     }
 }
            public WatchPropertyChangesWithinChangeScope(IElementChangeScope scope, Action action)
            {
                this.action = action;
                this.scope  = scope;
                this.scope.CollectionChanged += new NotifyCollectionChangedEventHandler(scope_CollectionChanged);

                propertyWatchers = new List <WatchForValuePropertyChanges>();
                ReCreatePropertyWatchers(this.scope);
            }
        protected override void Dispose(bool disposing)
        {
            if (changeScope != null)
            {
                changeScope.Dispose();
                changeScope = null;
            }

            base.Dispose(disposing);
        }
Exemple #4
0
            private void CreateElementScope(ElementViewModel element)
            {
                scopeElement = element;

                this.elementChangeScope = lookup.CreateChangeScope(
                    x => referenceAttribute.TargetType.IsAssignableFrom(x.ConfigurationType) &&
                    x.AncestorElements().Where(y => y.Path == scopeElement.Path).Any());

                elementChangeScope.CollectionChanged += ElementScopeChangedHandler;
            }
        protected override void Dispose(bool disposing)
        {
            if (changeScope != null)
            {
                changeScope.Dispose();
                changeScope = null;
            }

            base.Dispose(disposing);
        }
Exemple #6
0
            public ExtendedPropertyContainer(ElementLookup lookup, ElementViewModel subject,
                                             ObservableCollection <Property> properties)
            {
                this.properties           = properties;
                this.subject              = subject;
                extendedPropetryProviders = lookup.FindExtendedPropertyProviders();
                extendedPropetryProviders.CollectionChanged += extendedPropetryProviders_CollectionChanged;

                Refresh();
            }
        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);
        }
Exemple #8
0
            public void Dispose()
            {
                if (extendedPropetryProviders != null)
                {
                    extendedPropetryProviders.CollectionChanged -= extendedPropetryProviders_CollectionChanged;
                    extendedPropetryProviders.Dispose();
                    extendedPropetryProviders = null;
                }

                GC.SuppressFinalize(this);
            }
        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);
        }
        public override void Initialize(InitializeContext context)
        {
            base.Initialize(context);

            IElementChangeScope aliasElementChangeScope = lookup.CreateChangeScope(x =>
                                                                                   typeof(NamespaceElement).IsAssignableFrom(x.ConfigurationType) ||
                                                                                   typeof(SectionExtensionElement).IsAssignableFrom(x.ConfigurationType) ||
                                                                                   typeof(AliasElement).IsAssignableFrom(x.ConfigurationType) ||
                                                                                   typeof(AssemblyElement).IsAssignableFrom(x.ConfigurationType));

            watchAliasElementPropertyChanges = new WatchPropertyChangesWithinChangeScope(aliasElementChangeScope, SignalRegistrationTypeChanges);
        }
        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;
        }
        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;
        }
Exemple #13
0
            protected virtual void Dispose(bool disposing)
            {
                if (elementChangeScope != null)
                {
                    elementChangeScope.CollectionChanged -= ElementScopeChangedHandler;
                    elementChangeScope.Dispose();
                    elementChangeScope = null;
                }

                if (scopeChangeScope != null)
                {
                    scopeChangeScope.CollectionChanged -= ScopeChangedHandler;
                    scopeChangeScope.Dispose();
                    scopeChangeScope = null;
                }
            }
        private HorizontalListLayout(IEnumerable<ViewModel> elements, int nestingDepth, HorizontalListLayout root, IElementChangeScope changeScope)
        {
            this.nestingDepth = nestingDepth;

            this.current = elements.First();
            this.hasNext = elements.Count() > 1;
            this.elements = elements;

            rootListLayout = root ?? this;

            OwnsResizing = true;

            this.changeScope = changeScope;
            if (this.changeScope != null)
            {
                this.changeScope.CollectionChanged += ForcePropertyRequery;
            }
        }
Exemple #15
0
        private HorizontalListLayout(IEnumerable <ViewModel> elements, int nestingDepth, HorizontalListLayout root, IElementChangeScope changeScope)
        {
            this.nestingDepth = nestingDepth;

            this.current  = elements.First();
            this.hasNext  = elements.Count() > 1;
            this.elements = elements;

            rootListLayout = root ?? this;

            OwnsResizing = true;

            this.changeScope = changeScope;
            if (this.changeScope != null)
            {
                this.changeScope.CollectionChanged += ForcePropertyRequery;
            }
        }
Exemple #16
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;
                    }
                }
            }
            private void CreateElementScope(ElementViewModel element)
            {
                scopeElement = element;

                this.elementChangeScope = lookup.CreateChangeScope(
                            x => referenceAttribute.TargetType.IsAssignableFrom(x.ConfigurationType)
                                 && x.AncestorElements().Where(y => y.Path == scopeElement.Path).Any());

                elementChangeScope.CollectionChanged += ElementScopeChangedHandler;
            }
            public WatchPropertyChangesWithinChangeScope(IElementChangeScope scope, Action action)
            {
                this.action = action;
                this.scope = scope;
                this.scope.CollectionChanged += new NotifyCollectionChangedEventHandler(scope_CollectionChanged);

                propertyWatchers = new List<WatchForValuePropertyChanges>();
                ReCreatePropertyWatchers(this.scope);
            }
 private void ReCreatePropertyWatchers(IElementChangeScope elementChangeScope)
 {
     ClearPropertyWatchers();
     foreach (var property in elementChangeScope.SelectMany(x=>x.Properties))
     {
         propertyWatchers.Add(new WatchForValuePropertyChanges(property, action));
     }
 }
 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));
 }
Exemple #21
0
 /// <summary>
 /// Initializes a new instance of <see cref="HorizontalListLayout"/>.
 /// </summary>
 /// <param name="changeScope">An <see cref="IElementChangeScope"/> instance that should be used to recalculate the visibility of resize controls with.</param>
 /// <param name="elements">The <see cref="ViewModel"/> elements that should be displayed horizontally.</param>
 public HorizontalListLayout(IElementChangeScope changeScope, params ViewModel[] elements)
     : this((IEnumerable <ViewModel>)elements, 0, null, changeScope)
 {
 }
 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));
 }
 /// <summary>
 /// Initializes a new instance of <see cref="HorizontalListLayout"/>.
 /// </summary>
 /// <param name="changeScope">An <see cref="IElementChangeScope"/> instance that should be used to recalculate the visibility of resize controls with.</param>
 /// <param name="elements">The <see cref="ViewModel"/> elements that should be displayed horizontally.</param>
 public HorizontalListLayout(IElementChangeScope changeScope, params ViewModel[] elements)
     : this((IEnumerable<ViewModel>)elements, 0, null, changeScope)
 {
 }
            protected virtual void Dispose(bool disposing)
            {
                if (elementChangeScope != null)
                {
                    elementChangeScope.CollectionChanged -= ElementScopeChangedHandler;
                    elementChangeScope.Dispose();
                    elementChangeScope = null;
                }

                if (scopeChangeScope != null)
                {
                    scopeChangeScope.CollectionChanged -= ScopeChangedHandler;
                    scopeChangeScope.Dispose();
                    scopeChangeScope = null;
                }    
            }
            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;
                    }
                }
            }