public void Process(XamlInstruction instruction)
        {
            if (recording)
            {
                if (instruction.InstructionType == XamlInstructionType.StartMember)
                {
                    depth++;
                }

                if (instruction.InstructionType == XamlInstructionType.EndMember)
                {
                    depth--;
                    if (depth == 0)
                    {
                        recording = false;
                        var loaded = assembler.Load(new ReadOnlyCollection <XamlInstruction>(nodeList), WiringContext);
                        objectAssembler.OverrideInstance(loaded);
                        objectAssembler.Process(instruction);
                    }
                }

                if (depth > 0)
                {
                    nodeList.Add(instruction);
                }
            }
            else
            {
                if (instruction.InstructionType == XamlInstructionType.StartMember && !instruction.Member.IsDirective)
                {
                    var hasAssembler = TryGetDeferredAssembler((MutableXamlMember)instruction.Member, out assembler);
                    if (hasAssembler)
                    {
                        recording = true;
                        nodeList  = new Collection <XamlInstruction>();
                        depth++;
                        objectAssembler.Process(instruction);
                    }
                }

                if (!recording)
                {
                    objectAssembler.Process(instruction);
                }
            }
        }
        public void Process(XamlInstruction instruction)
        {
            if (recording)
            {
                if (instruction.InstructionType == XamlInstructionType.StartMember)
                {
                    depth++;
                }

                if (instruction.InstructionType == XamlInstructionType.EndMember)
                {
                    depth--;
                    if (depth == 0)
                    {
                        recording = false;
                        var loaded = assembler.Load(new ReadOnlyCollection<XamlInstruction>(nodeList), WiringContext);
                        objectAssembler.OverrideInstance(loaded);
                        objectAssembler.Process(instruction);
                    }
                }

                if (depth > 0)
                {
                    nodeList.Add(instruction);
                }
            }
            else
            {
                if (instruction.InstructionType == XamlInstructionType.StartMember && !instruction.Member.IsDirective)
                {
                    var hasAssembler = TryGetDeferredAssembler((MutableXamlMember) instruction.Member, out assembler);
                    if (hasAssembler)
                    {
                        recording = true;
                        nodeList = new Collection<XamlInstruction>();
                        depth++;
                        objectAssembler.Process(instruction);
                    }
                }

                if (!recording)
                {
                    objectAssembler.Process(instruction);
                }
            }
        }
Ejemplo n.º 3
0
 public void Process(XamlInstruction node)
 {
     _objectAssembler.Process(node);
 }
Ejemplo n.º 4
0
 private static bool IsTrailing(XamlInstruction xamlInstruction)
 {
     return xamlInstruction.InstructionType == XamlInstructionType.EndMember || xamlInstruction.InstructionType == XamlInstructionType.EndObject;
 }
Ejemplo n.º 5
0
 private static bool IsLeading(XamlInstruction current)
 {
     return current.InstructionType == XamlInstructionType.StartMember || current.InstructionType == XamlInstructionType.StartObject;
 }
Ejemplo n.º 6
0
 public bool Equals(XamlInstruction other)
 {
     return(instructionType == other.instructionType && Equals(data, other.data) && internalNodeType == other.internalNodeType);
 }
Ejemplo n.º 7
0
 public bool Equals(XamlInstruction other)
 {
     return instructionType == other.instructionType && Equals(data, other.data) && internalNodeType == other.internalNodeType;
 }
Ejemplo n.º 8
0
 private static bool IsLeading(XamlInstruction current)
 {
     return(current.InstructionType == XamlInstructionType.StartMember || current.InstructionType == XamlInstructionType.StartObject ||
            current.InstructionType == XamlInstructionType.GetObject);
 }
Ejemplo n.º 9
0
 private static bool IsTrailing(XamlInstruction xamlInstruction)
 {
     return(xamlInstruction.InstructionType == XamlInstructionType.EndMember || xamlInstruction.InstructionType == XamlInstructionType.EndObject);
 }