public SelectorTreeNodeCollectionEnumerator(StylesheetTreeNodeCollection owner)
 {
     if (owner.nodes != null)
     {
         this.ownerEnumerator = owner.nodes.GetEnumerator();
     }
     else
     {
         this.ownerEnumerator = null;
     }
 }
Example #2
0
        public StylesheetTreeNode(StylesheetTree ownerTree, IElementSelector selector)
        {
            this.ownerTree = ownerTree;
            this.selector  = selector;
            this.nodes     = new StylesheetTreeNodeCollection(this);
            int selectorKey = 0;

            //Generally RootNode registers with
            if (selector != null)
            {
                selectorKey = selector.Key;
            }
            ownerTree.RegisterNodeWithKey(selectorKey, this);
        }
Example #3
0
        public void DetachElements()
        {
            if (this.mappedElements != null)
            {
                if (this.propertySettingGroups != null)
                {
                    foreach (NodeElementEntry elementEntry in this.mappedElements.Values)
                    {
                        this.ManagePropetyChangeSubscription(elementEntry, false);

                        for (int i = 0; i < this.propertySettingGroups.Count; i++)
                        {
                            foreach (IPropertySetting setting in this.propertySettingGroups[i].PropertySettings.EnumeratePropertySettingsForElement(elementEntry.Element))
                            {
                                setting.UnapplyValue(elementEntry.Element);

                                if (setting is AnimatedPropertySetting)
                                {
                                    elementEntry.Element.ResetValue(setting.Property, ValueResetFlags.Style);
                                }
                            }
                        }
                    }

                    this.propertySettingGroups.Clear();
                    this.propertySettingGroups = null;
                }

                this.mappedElements.Clear();
                this.mappedElements = null;
            }

            if (this.nodes != null)
            {
                foreach (StylesheetTreeNode node in this.nodes)
                {
                    node.DetachElements();
                }
                this.nodes.Clear();
                this.nodes = null;
            }

            this.ownerTree = null;
        }
        private StylesheetTreeNode AddNodeRecursive(PropertySettingGroup propertySettings, IElementSelector selector, StylesheetTreeNodeCollection parentNodeCollection)
        {
            if (selector.Key == 0)
            {
                return(null);
            }

            StylesheetTreeNode node = parentNodeCollection.FindSelectorNode(selector.Key);

            if (node == null)
            {
                node = new StylesheetTreeNode(this.ownerNode.OwnerTree, selector);
                parentNodeCollection.RegisterSelectorNode(node);
            }

            if (selector.ChildSelector != null)
            {
                this.AddNodeRecursive(propertySettings, selector.ChildSelector, node.Nodes);
            }
            else
            {
                node.PropertySettingGroups.Add(propertySettings);
            }

            return(node);
        }