示例#1
0
        protected InstructionLDParallel(IEditorItem parent, NodeInstruction instruction)
            : base(parent, m_InstructionType)
        {
            if (instruction == null)
            {
                var newInstruction = NodeInstruction.BuildWith(InstructionType);
                newInstruction = newInstruction.NodeInstructionChildren.Append(
                    InstructionLDSeries.EmptyRung());
                newInstruction = newInstruction.NodeInstructionChildren.Append(
                    InstructionLDSeries.EmptyRung());
                Instruction = newInstruction;
            }
            else
            {
                if (instruction.InstructionType != InstructionType)
                {
                    throw new InvalidOperationException("Tried to instantiate InstructionLDParallel but passed a different instruction type.");
                }
                Instruction = instruction;
            }

            // Build the context menu
            if (extensionService != null)
            {
                ContextMenu        = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu);
                ContextMenuEnabled = true;
            }
        }
示例#2
0
        private static NodeInstructionGroup emptyNode()
        {
            var newInstructionGroup = NodeInstructionGroup.BuildWith(
                new FieldIdentifier(Extensions.Workbench.Documents.PageEditor_.InstructionGroupItems.LD));

            newInstructionGroup = newInstructionGroup.NodeInstructionChildren.Append(
                InstructionLDSeries.EmptyRung()); // empty rungs are just a Series instruction
            return(newInstructionGroup);
        }