Exemplo n.º 1
0
        private XSModelGroup()
        {
            _compositor = XSCompositor.Sequence;
            _group      = new XmlSchemaSequence();

            Components          = new XSComponentFixedList();
            Particles           = new XSComponentList();
            Particles.Inserted += Particles_Inserted;
            Particles.Cleared  += Particles_Cleared;
        }
Exemplo n.º 2
0
        internal XSModelGroup(XmlSchemaGroupBase groupBase)
            : this()
        {
            _group = groupBase;

            if (_group.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }

            if (groupBase is XmlSchemaAll)
            {
                _compositor = XSCompositor.All;
            }

            else if (groupBase is XmlSchemaChoice)
            {
                _compositor = XSCompositor.Choice;
            }

            else if (groupBase is XmlSchemaSequence)
            {
                _compositor = XSCompositor.Sequence;
            }

            Particles.Inserted -= Particles_Inserted;

            foreach (XmlSchemaObject item in _group.Items)
            {
                IXSComponent component = XMLSchemaSerializer.CreateInstance(item);
                component.BindToContainer(RootContainer, this);
                Particles.Add(component);
                Components.Add(component);
            }

            Particles.Inserted += Particles_Inserted;
        }