private XmlElementSelector CreateSelector(ElementSelector selector)
        {
            XmlSelectorBase xmlSelectorBase = (XmlSelectorBase)null;
            WrapSelector    wrapSelector    = selector as WrapSelector;

            if (wrapSelector != null)
            {
                TypeSelector internalSelector1 = wrapSelector.InternalSelector as TypeSelector;
                if (internalSelector1 != null)
                {
                    return((XmlElementSelector) new XmlTypeSelector(XmlTheme.SerializeType(internalSelector1.ElementType)));
                }
                ClassSelector internalSelector2 = wrapSelector.InternalSelector as ClassSelector;
                if (internalSelector2 != null)
                {
                    return((XmlElementSelector) new XmlClassSelector(internalSelector2.ElementClass));
                }
            }
            if (selector.Type == ElementSelectorTypes.VisualStateSelector)
            {
                xmlSelectorBase = (XmlSelectorBase) new XmlVisualStateSelector(selector.Value);
            }
            else if (selector.Type == ElementSelectorTypes.TypeSelector)
            {
                xmlSelectorBase = (XmlSelectorBase) new XmlTypeSelector(selector.Value);
            }
            else if (selector.Type == ElementSelectorTypes.ClassSelector)
            {
                xmlSelectorBase = (XmlSelectorBase) new XmlClassSelector(selector.Value);
            }
            if (selector.ChildSelector != null)
            {
                xmlSelectorBase.ChildSelector = this.CreateSelector(selector.ChildSelector);
            }
            return((XmlElementSelector)xmlSelectorBase);
        }
Exemple #2
0
        public override bool Equals(IElementSelector elementSelector)
        {
            TypeSelector selector = elementSelector as TypeSelector;

            return(selector != null && selector.elementType == this.elementType);
        }