Exemplo n.º 1
0
        private void ReadXml(XmlReader reader)
        {
            if (ViewSpecs != null)
            {
                throw new ReadOnlyException();
            }
            if (reader.IsEmptyElement)
            {
                ViewSpecs = ImmutableList.Empty <ViewSpec>();
                reader.ReadElementString("views"); // Not L10N
                return;
            }
            reader.Read();
            var viewItems = new List <ViewSpec>();

            while (true)
            {
                if (reader.IsStartElement("view")) // Not L10N
                {
                    viewItems.Add(ViewSpec.ReadXml(reader));
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.ReadEndElement();
                    break;
                }
                else
                {
                    reader.Read();
                }
            }
            ViewSpecs = ImmutableList.ValueOf(viewItems);
        }
Exemplo n.º 2
0
        public void ReadXml(XmlReader reader)
        {
            Name = reader.GetAttribute("name");
            if (reader.IsEmptyElement)
            {
                reader.ReadElementString("views");
                return;
            }
            reader.Read();
            var viewSpecs = new List <ViewSpec>();

            while (true)
            {
                if (reader.IsStartElement("view"))
                {
                    viewSpecs.Add(ViewSpec.ReadXml(reader));
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.ReadEndElement();
                    break;
                }
                else
                {
                    reader.Read();
                }
            }
            ViewSpecs = viewSpecs.AsReadOnly();
        }
Exemplo n.º 3
0
        private void ReadXml(XmlReader reader)
        {
            if (Views != null)
            {
                throw new ReadOnlyException();
            }

            if (reader.IsEmptyElement)
            {
                ViewSpecLayouts = ImmutableList.Empty <ViewSpecLayout>();
                reader.ReadElementString(@"views");
                return;
            }
            reader.Read();
            var viewItems = new List <ViewSpec>();
            var layouts   = new List <ViewLayoutList>();

            while (true)
            {
                if (reader.IsStartElement(@"view"))
                {
                    viewItems.Add(ViewSpec.ReadXml(reader));
                }
                else if (reader.IsStartElement(@"layouts"))
                {
                    layouts.Add(ViewLayoutList.ReadXml(reader));
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.ReadEndElement();
                    break;
                }
                else
                {
                    reader.Skip();
                }
            }

            ViewSpecLayouts = ImmutableList.ValueOf(MakeViewSpecLayouts(viewItems, layouts));
        }