Exemple #1
0
        static void Main(string[] args)
        {
            var container = new WindsorContainer();

            container.Register(Component.For <IMachine>().ImplementedBy <PackSizeMachine>());
            ToolFactory factory = new ToolFactory();
            var         root    = container.Resolve <IMachine>(new { instructionSet = args[0], factory = factory });

            root.ProcessInstructions();
        }
Exemple #2
0
 public PackSizeMachine(string instructionSet, ToolFactory factory)
 {
     _nextLongCut            = 0;
     _longCutHeadIndex       = 0;
     _crossCutTool           = factory.CreateTool(ToolType.Cross_Cut, "0");
     _longcutToolLeft        = factory.CreateTool(ToolType.Long_Cut, "0");
     _longcutToolCenterLeft  = factory.CreateTool(ToolType.Long_Cut, "1");
     _longcutToolCenterRight = factory.CreateTool(ToolType.Long_Cut, "2");
     _longcutToolRight       = factory.CreateTool(ToolType.Long_Cut, "3");
     CurrentYCoordinates     = 0;
     InstructionSet          = new List <List <Instruction> >();
     _instructionSet         = JsonConvert.DeserializeObject <List <Instruction> >(instructionSet).OrderBy(x => x.InstructionNumber).ToList();
 }