コード例 #1
0
        protected override void DeserializeProperties(IElementSelector selector)
        {
            SelectorBase selectorBase = (SelectorBase)selector;

            if (this.Condition != null)
            {
                selectorBase.Condition = this.Condition.Deserialize();
            }
            if (this.UnapplyCondition != null)
            {
                selectorBase.UnapplyCondition = this.UnapplyCondition.Deserialize();
            }
            if (this.ChildSelector != null)
            {
                selectorBase.ChildSelector = this.ChildSelector.Deserialize();
            }
            selectorBase.AutoUnapply = this.AutoUnapply;
        }
コード例 #2
0
        /// <summary>
        /// This method supports TPF infrastructure and is intended for internal use only.
        /// </summary>
        /// <param name="applyUnconditional"></param>
        /// <param name="groups"></param>
        /// <returns></returns>
        public StyleSheet GetStyleSheet(XmlSelectorBase applyUnconditional, XmlPropertySettingGroup[] groups)
        {
            StyleSheet   res           = new StyleSheet();
            SelectorBase applySelector = null;

            if (this.PropertySettingGroups == null)
            {
                return(res);
            }

            for (int i = 0; i < this.PropertySettingGroups.Count; i++)
            {
                XmlPropertySettingGroup xmlGroup = this.PropertySettingGroups[i];
                if (xmlGroup.Selectors != null)
                {
                    for (int selectorIndex = 0; selectorIndex < xmlGroup.Selectors.Count; selectorIndex++)
                    {
                        XmlElementSelector xmlSelector = xmlGroup.Selectors[selectorIndex];
                        if (xmlSelector == applyUnconditional)
                        {
                            applySelector = (SelectorBase)xmlSelector.Deserialize();
                            break;
                        }
                    }
                }
            }

            for (int i = 0; i < this.PropertySettingGroups.Count; i++)
            {
                XmlPropertySettingGroup xmlGroup = this.PropertySettingGroups[i];
                PropertySettingGroup    group    = new PropertySettingGroup();

                if (xmlGroup.PropertySettings == null ||
                    xmlGroup.Selectors == null)
                {
                    continue;
                }

                bool disable = false;
                if (applyUnconditional != null)
                {
                    for (int groupIndex = 0; groupIndex < groups.Length; groupIndex++)
                    {
                        XmlPropertySettingGroup g = groups[groupIndex];
                        if (g == xmlGroup)
                        {
                            disable = true;
                            break;
                        }
                    }
                }

                for (int settingIndex = 0; settingIndex < xmlGroup.PropertySettings.Count; settingIndex++)
                {
                    XmlPropertySetting xmlPropertySetting = xmlGroup.PropertySettings[settingIndex];
                    IPropertySetting   setting            = xmlPropertySetting.Deserialize();
                    group.PropertySettings.Add(setting);
                }

                //IElementSelector activeSelector = null;

                for (int selectorIndex = 0; selectorIndex < xmlGroup.Selectors.Count; selectorIndex++)
                {
                    XmlElementSelector xmlSelector = xmlGroup.Selectors[selectorIndex];
                    IElementSelector   selector    = null;
                    selector = xmlSelector.Deserialize();

                    if (xmlSelector == applyUnconditional)
                    {
                        applySelector.IsActiveSelectorInStyleBuilder = true;
                        selector = applySelector;
                        //continue;
                    }
                    else if (disable)
                    {
                        ((SelectorBase)selector).DisableStyle = true;
                        //((SelectorBase)selector).ExcludeSelector = applySelector;
                    }

                    group.Selectors.Add(selector);
                }

                //if (activeSelector != null)
                //	group.Selectors.Insert(0, activeSelector);

                res.PropertySettingGroups.Add(group);
            }

            return(res);
        }