Esempio n. 1
0
        public void Process(Instruction instruction)
        {
            Command command;

            switch (instruction.InstructionType)
            {
                case InstructionType.NamespaceDeclaration:
                    command = new NamespaceDeclarationCommand(instruction.NamespaceDeclaration, StateCommuter);
                    break;
                case InstructionType.StartObject:
                    command = new StartObjectCommand(StateCommuter, TypeSource, instruction.XamlType, rootInstance);
                    break;
                case InstructionType.StartMember:
                    command = new StartMemberCommand(StateCommuter, GetActualMemberFromMemberSpecifiedInInstruction(instruction.Member));
                    break;
                case InstructionType.Value:
                    command = new ValueCommand(StateCommuter, this.TypeSource, TopDownValueContext, (string)instruction.Value);
                    break;
                case InstructionType.EndObject:
                    command = new EndObjectCommand(StateCommuter, stateCommuter => Result = stateCommuter.Current.Instance);
                    break;
                case InstructionType.EndMember:
                    command = new EndMemberCommand(TypeSource, StateCommuter);
                    break;
                case InstructionType.GetObject:
                    command = new GetObjectCommand(StateCommuter);
                    break;
                default:
                    throw new ParseException($"The XamlInstructionType {instruction.InstructionType} has an unexpected value");
            }

            command.Execute();
        }
Esempio n. 2
0
        public void Process(Instruction instruction)
        {
            Command command;

            switch (instruction.InstructionType)
            {
            case InstructionType.NamespaceDeclaration:
                command = new NamespaceDeclarationCommand(instruction.NamespaceDeclaration, StateCommuter);
                break;

            case InstructionType.StartObject:
                command = new StartObjectCommand(StateCommuter, TypeSource, instruction.XamlType, rootInstance);
                break;

            case InstructionType.StartMember:
                command = new StartMemberCommand(StateCommuter, GetActualMemberFromMemberSpecifiedInInstruction(instruction.Member));
                break;

            case InstructionType.Value:
                command = new ValueCommand(StateCommuter, valueContext, (string)instruction.Value);
                break;

            case InstructionType.EndObject:
                command = new EndObjectCommand(StateCommuter, stateCommuter => Result = stateCommuter.Current.Instance, LifecycleListener);
                break;

            case InstructionType.EndMember:
                command = new EndMemberCommand(TypeSource, StateCommuter, valueContext);
                break;

            case InstructionType.GetObject:
                command = new GetObjectCommand(StateCommuter);
                break;

            default:
                throw new ParseException($"The XamlInstructionType {instruction.InstructionType} has an unexpected value");
            }

            command.Execute();
        }
Esempio n. 3
0
        public void Process(XamlInstruction instruction)
        {
            Command command;

            switch (instruction.InstructionType)
            {
            case XamlInstructionType.NamespaceDeclaration:
                command = new NamespaceDeclarationCommand(this, instruction.NamespaceDeclaration);
                break;

            case XamlInstructionType.StartObject:
                command = new StartObjectCommand(this, instruction.XamlType, rootInstance);
                break;

            case XamlInstructionType.StartMember:
                command = new StartMemberCommand(this, GetMember(instruction.Member));
                break;

            case XamlInstructionType.Value:
                command = new ValueCommand(this, topDownValueContext, (string)instruction.Value);
                break;

            case XamlInstructionType.EndObject:
                command = new EndObjectCommand(this);
                break;

            case XamlInstructionType.EndMember:
                command = new EndMemberCommand(this, topDownValueContext);
                break;

            case XamlInstructionType.GetObject:
                command = new GetObjectCommand(this);
                break;

            default:
                throw new XamlParseException($"The XamlInstructionType {instruction.InstructionType} has an unexpected value");
            }

            command.Execute();
        }
Esempio n. 4
0
        public void Process(XamlInstruction instruction)
        {
            Command command;

            switch (instruction.InstructionType)
            {
                case XamlInstructionType.NamespaceDeclaration:
                    command = new NamespaceDeclarationCommand(this, instruction.NamespaceDeclaration);
                    break;
                case XamlInstructionType.StartObject:
                    command = new StartObjectCommand(this, instruction.XamlType, rootInstance);
                    break;
                case XamlInstructionType.StartMember:
                    command = new StartMemberCommand(this, GetMember(instruction.Member));
                    break;
                case XamlInstructionType.Value:
                    command = new ValueCommand(this, topDownValueContext, (string)instruction.Value);
                    break;
                case XamlInstructionType.EndObject:
                    command = new EndObjectCommand(this);
                    break;
                case XamlInstructionType.EndMember:
                    command = new EndMemberCommand(this, topDownValueContext);
                    break;
                case XamlInstructionType.GetObject:
                    command = new GetObjectCommand(this);
                    break;
                default:
                    throw new XamlParseException($"The XamlInstructionType {instruction.InstructionType} has an unexpected value");
            }

            command.Execute();
        }
        public void Process(XamlNode node)
        {
            Command command;

            switch (node.NodeType)
            {
                case XamlNodeType.NamespaceDeclaration:
                    command = new NamespaceDeclarationCommand(this, node.NamespaceDeclaration);
                    break;
                case XamlNodeType.StartObject:
                    command = new StartObjectCommand(this, node.XamlType, rootInstance);
                    break;
                case XamlNodeType.StartMember:
                    command = new StartMemberCommand(this, GetMember(node.Member));
                    break;
                case XamlNodeType.Value:
                    command = new ValueCommand(this, (string)node.Value);
                    break;
                case XamlNodeType.EndObject:
                    command = new EndObjectCommand(this);
                    break;
                case XamlNodeType.EndMember:
                    command = new EndMemberCommand(this, topDownMemberValueContext);
                    break;
                case XamlNodeType.GetObject:
                    command = new GetObjectCommand(this);
                    break;
                default:
                    throw new InvalidOperationException();
            }

            command.Execute();
        }