private void frmLiftSim_Load(object sender, EventArgs e) { // Create our lift objects, assigning them the image they need to control, // the array of floor locations, and which floors they should 'idle' on. lift1 = new Lift(pbxLift1, FLOOR_Y, IDLE_FLOORS[0], this, 1); lift2 = new Lift(pbxLift2, FLOOR_Y, IDLE_FLOORS[1], this, 2); lift3 = new Lift(pbxLift3, FLOOR_Y, IDLE_FLOORS[2], this, 3); // Hand our lifts over to our LiftController object lc.AddLift(lift1); lc.AddLift(lift2); lc.AddLift(lift3); // Stick our lift buttons into our array so we can control them easier (well, that's the plan) liftButtons[0] = new Button[5] { btnL1FG, btnL1F1, btnL1F2, btnL1F3, btnL1F4 }; liftButtons[1] = new Button[5] { btnL2FG, btnL2F1, btnL2F2, btnL2F3, btnL2F4 }; liftButtons[2] = new Button[5] { btnL3FG, btnL3F1, btnL3F2, btnL3F3, btnL3F4 }; // Same thing for our call 'buttons' callButtons[0] = new PictureBox[2] { null, pbx0Up }; callButtons[1] = new PictureBox[2] { pbx1Down, pbx1Up }; callButtons[2] = new PictureBox[2] { pbx2Down, pbx2Up }; callButtons[3] = new PictureBox[2] { pbx3Down, pbx3Up }; callButtons[4] = new PictureBox[2] { pbx4Down, null }; }
/// <summary> /// Add a lift to the controller. Do not add more lifts than the controller was intended /// to handle when it was instantiated. /// </summary> /// <param name="lift">A Lift object.</param> public void AddLift(Lift lift) { lifts[lai] = lift; lai++; }