Example #1
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();
            ticketMachine   = new TicketMachine(activeTickets);
            ticketValidator = new TicketValidator(activeTickets);
            entryBarrier    = new Barrier();
            exitBarrier     = new Barrier();
            fullSign        = new FullSign();



            entryBarrier2 = new Barrier();
            exitBarrier2  = new Barrier();


            ticketMachine2   = new TicketMachine(activeTickets);
            ticketValidator2 = new TicketValidator(activeTickets);

            carPark = new CarPark(ticketMachine, ticketMachine2, ticketValidator, ticketValidator2, fullSign, entryBarrier, entryBarrier2, exitBarrier, exitBarrier2);


            entrySensor = new EntrySensor(carPark);
            exitSensor  = new ExitSensor(carPark);


            entrySensor2 = new EntrySensor(carPark);
            exitSensor2  = new ExitSensor(carPark);

            paymentMachine = new PaymentMachine();
            ticketMachine.AssignCarPark(carPark);
            ticketValidator.AssignCarPark(carPark);

            ticketMachine2.AssignCarPark(carPark);
            ticketValidator.AssignCarPark(carPark);

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

            btnCarArrivesAtEntrance.Visible   = true;
            btnDriverPressesForTicket.Visible = false;
            btnCarEntersCarPark.Visible       = false;
            btnCarArrivesAtExit.Visible       = false;
            btnDriverEntersTicket.Visible     = false;
            btnCarExitsCarPark.Visible        = false;

            btnCarArrivesAtEntrance2.Visible   = true;
            btnDriverPressesForTicket2.Visible = false;
            btnCarEntersCarPark2.Visible       = false;
            btnCarArrivesAtExit2.Visible       = false;
            btnDriverEntersTicket2.Visible     = false;
            btnCarExitsCarPark2.Visible        = false;

            UpdateDisplay();
        }
Example #2
0
        public CarPark(TicketMachine ticketMachine, TicketValidator ticketValidator, FullSign fullSign, Barrier entryBarrier, Barrier exitBarrier, int maxspaces)
        {
            this.currentSpaces = maxspaces;
            this.maxSpace      = maxspaces;

            this.entryBarrier    = entryBarrier;
            this.exitBarrier     = exitBarrier;
            this.ticketMachine   = ticketMachine;
            this.ticketValidator = ticketValidator;
            this.fullSign        = fullSign;
            this.paymentMachine  = new PaymentMachine();

            for (int i = 0; i < maxSpace; i++)
            {
                spaces.Add(new SpaceSensor(this, i));
            }
        }