Beispiel #1
0
        /************************************************************************************************/


        /// <summary>
        /// Create a new Lift object.
        /// </summary>
        /// <param name="limg">The PictureBox control this Lift object is associated to.</param>
        /// <param name="fy">The list of floor y coordinates</param>
        /// <param name="sf">The floor the lift will idle/start on</param>
        /// <param name="mf">The main form (pass in 'this')</param>
        public Lift(PictureBox limg, int[] fy, int sf, frmLiftSim mf, int id)
        {
            liftImage = limg;
            floor_y   = fy;
            idleFloor = sf;
            mainForm  = mf;
            liftID    = id;

            liftImage.Top = floor_y[idleFloor];  // Move lift to the start position
            currentFloor  = idleFloor;           // Set the lift's current position

            mainForm.AddToLog("Lift " + liftID + " initialised. Start floor: " + currentFloor);

            dtMove.Interval = TimeSpan.FromMilliseconds(20);
            dtMove.Tick    += new EventHandler(dtMove_Tick);

            dtWait.Interval = TimeSpan.FromSeconds(2);
            dtWait.Tick    += new EventHandler(dtWait_Tick);

            mainForm.UpdateFloorDisp(currentFloor, liftID);
        }
Beispiel #2
0
        private int nextDestFloor; // Next floor the lift is heading to

        #endregion Fields

        #region Constructors

        /************************************************************************************************/
        /// <summary>
        /// Create a new Lift object.
        /// </summary>
        /// <param name="limg">The PictureBox control this Lift object is associated to.</param>
        /// <param name="fy">The list of floor y coordinates</param>
        /// <param name="sf">The floor the lift will idle/start on</param>
        /// <param name="mf">The main form (pass in 'this')</param>
        public Lift(PictureBox limg, int[] fy, int sf, frmLiftSim mf, int id)
        {
            liftImage = limg;
            floor_y = fy;
            idleFloor = sf;
            mainForm = mf;
            liftID = id;

            liftImage.Top = floor_y[idleFloor];  // Move lift to the start position
            currentFloor = idleFloor;            // Set the lift's current position

            mainForm.AddToLog("Lift " + liftID + " initialised. Start floor: " + currentFloor);

            dtMove.Interval = TimeSpan.FromMilliseconds(20);
            dtMove.Tick += new EventHandler(dtMove_Tick);

            dtWait.Interval = TimeSpan.FromSeconds(2);
            dtWait.Tick += new EventHandler(dtWait_Tick);

            mainForm.UpdateFloorDisp(currentFloor, liftID);
        }