Exemple #1
0
        private IEnumerable <Instruction> ParseCollectionInsideThisProperty(MemberBase member)
        {
            yield return(Inject.StartOfMember(member));

            if (IsBeginingOfImplicitCollection)
            {
                yield return(Inject.GetObject());

                yield return(Inject.Items());

                foreach (var instruction in ParseElements())
                {
                    yield return(instruction);
                }

                yield return(Inject.EndOfMember());

                yield return(Inject.EndOfObject());
            }
            else
            {
                foreach (var xamlInstruction in ParseNonEmptyElement())
                {
                    yield return(xamlInstruction);
                }
            }

            yield return(Inject.EndOfMember());
        }
Exemple #2
0
        private IEnumerable <XamlInstruction> ParseCollection()
        {
            yield return(Inject.Items());

            foreach (var instruction in ParseElements())
            {
                yield return(instruction);
            }

            yield return(Inject.EndOfMember());

            yield return(Inject.EndOfObject());
        }
Exemple #3
0
        private IEnumerable <Instruction> ParseNonEmptyElement()
        {
            yield return(Inject.StartOfObject(instructionStream.Current.XamlType));

            var parentType = instructionStream.Current.XamlType;

            if (parentType.NeedsConstructionParameters)
            {
                foreach (var instruction in InjectNodesForTypeThatRequiresInitialization())
                {
                    yield return(instruction);
                }
            }
            else
            {
                SetNextInstruction();

                foreach (var instruction in ParseMembersOfObject())
                {
                    yield return(instruction);
                }

                if (parentType.IsCollection)
                {
                    foreach (var instruction in ParseItemsOfCollection())
                    {
                        yield return(instruction);
                    }
                }
                else
                {
                    foreach (var instruction in ParseContentPropertyIfAny(parentType))
                    {
                        yield return(instruction);
                    }
                }

                SkipTextNodes();

                foreach (var instruction in ParseNestedProperties(parentType))
                {
                    yield return(instruction);
                }
            }

            yield return(Inject.EndOfObject());

            ReadEndTag();
        }
Exemple #4
0
        private IEnumerable <Instruction> ParseEmptyElement()
        {
            yield return(Inject.StartOfObject(instructionStream.Current.XamlType));

            SetNextInstruction();

            foreach (var member in ParseMembersOfObject())
            {
                yield return(member);
            }

            yield return(Inject.EndOfObject());

            if (CurrentNodeType == NodeType.Text)
            {
                SetNextInstruction();
            }
        }
Exemple #5
0
        public IEnumerable <Instruction> ParseMarkupExtensionNode(MarkupExtensionNode tree)
        {
            var identifierNode = tree.Identifier;
            var xamlType       = TypeSource.GetByPrefix(identifierNode.Prefix, identifierNode.TypeName);

            yield return(Inject.StartOfObject(xamlType));

            foreach (var instruction in ParseArguments(tree.Options.OfType <PositionalOption>()))
            {
                yield return(instruction);
            }
            foreach (var instruction in ParseProperties(tree.Options.OfType <PropertyOption>(), xamlType))
            {
                yield return(instruction);
            }

            yield return(Inject.EndOfObject());
        }
Exemple #6
0
        private IEnumerable <XamlInstruction> ParseCollectionInsideThisProperty(XamlMemberBase member)
        {
            yield return(Inject.StartOfMember(member));

            yield return(Inject.GetObject());

            yield return(Inject.Items());

            foreach (var instruction in ParseElements())
            {
                yield return(instruction);
            }

            yield return(Inject.EndOfMember());

            yield return(Inject.EndOfObject());

            yield return(Inject.EndOfMember());
        }