Exemple #1
0
        public override object Clone()
        {
            var when = new When();
            when.Expression = Expression;

            foreach (var node in Nodes)
                when.Nodes.Add((ThemeNode)node.Clone());

            return when;
        }
Exemple #2
0
        public override void ReadXml(XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
                if (!TryReadXmlAttribute(reader))
                    MapXmlReader.HandleUnexpectedAttribute(reader.LocalName);

            reader.MoveToElement();
            if (!reader.IsEmptyElement)
            {
                var isElsePresent = false;
                reader.Read();
                while (reader.MoveToContent() != XmlNodeType.EndElement)
                    if (reader.IsStartElement(When.ElementName) && !isElsePresent)
                    {
                        var when = new When();
                        Nodes.Add(when);
                        when.ReadXml(reader);
                    }
                    else if (reader.IsStartElement(Else.ElementName))
                    {
                        var elseNode = new Else();
                        Nodes.Add(elseNode);
                        elseNode.ReadXml(reader);
                        isElsePresent = true;
                    }
                    else MapXmlReader.HandleUnexpectedElement(reader.LocalName);
            }
            reader.Read();
        }