Beispiel #1
0
 //Constructor
 public CarPark(TicketMachine ticketMachine, TicketValidator ticketValidator, FullSign fullSign, Barrier entryBarrier, Barrier exitBarrier)
 {
     this.ticketMachine   = ticketMachine;
     this.ticketValidator = ticketValidator;
     this.fullSign        = fullSign;
     this.entryBarrier    = entryBarrier;
     this.exitBarrier     = exitBarrier;
     currentSpaces        = maxSpace;
     currentPrePaidSpaces = maxPrePaid;
     this.entry           = new EntrySensor(this);
 }
Beispiel #2
0
        // Operations ///
        private void ResetSystem(object sender, EventArgs e)
        {
            // STUDENTS:
            ///// Class contructors are not defined so there will be errors
            ///// This code is correct for the basic version though
            activeTickets        = new ActiveTickets();
            activePrePaidTickets = new ActivePrePaid();
            ticketMachine        = new TicketMachine(activeTickets, activePrePaidTickets);
            ticketValidator      = new TicketValidator(activeTickets, activePrePaidTickets);
            entryBarrier         = new Barrier();
            exitBarrier          = new Barrier();
            fullSign             = new FullSign();
            carPark     = new CarPark(ticketMachine, ticketValidator, fullSign, entryBarrier, exitBarrier);
            entrySensor = new EntrySensor(carPark);
            exitSensor  = new ExitSensor(carPark);

            ticketMachine.AssignCarPark(carPark);
            ticketValidator.AssignCarPark(carPark);

            /////////////////////////////////////////

            btnVehicleArrivesEntrance.Visible = true;
            btnNormalEntrance.Visible         = false;
            btnPrePaidEntrance.Visible        = false;
            btnEmergencyEntrance.Visible      = false;
            btnPrePaidEnters.Visible          = false;
            btnVehicleEnters.Visible          = false;

            btnVehicleArrivesExit.Visible = false;
            btnNormalExit.Visible         = false;
            btnPrePaidExit.Visible        = false;
            btnEmergencyExit.Visible      = false;
            btnVehicleExits.Visible       = false;
            btnPrePaidExits.Visible       = false;

            lblTicketMachine.Text   = "";
            lblTicketValidator.Text = "";
            lstActiveTickets.Items.Clear();
            lstPrePaidTickets.Items.Clear();

            UpdateDisplay();
        }