Beispiel #1
0
        public Building(frmMain Form)
        {
            this.parentForm = Form;
            lifter          = new Lifter(parentForm, this);
            // /*for (int i = 0; i < maxPeople; i++) */floor0List.Add(new Person(maxFloor, 1, lifter, parentForm));
            //for (int i = 0; i < elevatorCapacity + 15; i++)
            //    floor0List.Add(new Person(maxFloor,i + 1, lifter, parentForm));

            parentForm.updateFloors(floor0List, 0);

            Runner = new Thread(new ThreadStart(update));
            Runner.IsBackground = true;
            Runner.Start();
        }
 public Person(int maxFloor, int ID, Lifter lifter, frmMain parent)
 {
     parentForm                = parent;
     this.ID                   = ID;
     this.lifter               = lifter;
     floor                     = 0;
     inQueue                   = true;
     this.maxFloor             = maxFloor;
     nextFloor                 = getRandomNumber(1, maxFloor + 1);
     waitOnFloor               = 2000;
     direction                 = Direction.Up;
     personRunner              = new Thread(new ThreadStart(runner));
     personRunner.IsBackground = true;
     personRunner.Start();
 }