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


        // Operations ///
        private void ResetSystem(object sender, EventArgs e)
        {
            activeTickets   = new ActiveTickets();
            ticketMachine   = new TicketMachine(activeTickets);
            ticketValidator = new TicketValidator(activeTickets);
            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);

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

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

            UpdateDisplay();
        }
        // 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();
            carPark         = new CarPark(ticketMachine, ticketValidator, fullSign, entryBarrier, exitBarrier);
            entrySensor     = new EntrySensor(carPark);
            exitSensor      = new ExitSensor(carPark);

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

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

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

            UpdateDisplay();
        }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 public CarPark(TicketMachine tm, TicketValidator tv, FullSign fs, Barrier entryB, Barrier exitB)
 {
     //constructor
     ticketMachine   = tm;
     ticketValidator = tv;
     fullSign        = fs;
     entryBarrier    = entryB;
     exitBarrier     = exitB;
 }
Esempio n. 5
0
 public CarPark(PayTicket payForTicket, Barrier entryBarrier, Barrier exitBarrier, TicketValidator ticketValidator, FullSign fullSign, TicketMachine ticketMachine)
 {
     this.PayForTicket    = payForTicket;
     this.entryBarrier    = entryBarrier;
     this.exitBarrier     = exitBarrier;
     this.fullSign        = fullSign;
     this.ticketMachine   = ticketMachine;
     this.ticketValidator = ticketValidator;
 }
Esempio n. 6
0
 public void CarExitedCarPark(Barrier exitBarrier, TicketValidator ticketValidator, ExitSensor exitSensor, FullSign fullSign)
 {
     exitSensor.CarLeftSensor();
     exitBarrier.Lower();
     ticketValidator.ClearMessage();
     if (IsFull() == true)
     {
         fullSign.SetLit();
     }
     currentSpaces++;
 }
Esempio n. 7
0
        //constructor
        public CarPark(TicketMachine ticketMachine, TicketMachine ticketMachine2, TicketValidator ticketValidator, TicketValidator ticketValidator2, FullSign fullsign, Barrier entryBarrier, Barrier entryBarrier2, Barrier exitBarrier, Barrier exitBarrier2)
        {
            currentSpaces        = maxSpaces;
            this.ticketMachine   = ticketMachine;
            this.ticketValidator = ticketValidator;
            this.fullsign        = fullsign;
            this.entryBarrier    = entryBarrier;
            this.exitBarrier     = exitBarrier;


            this.ticketMachine2   = ticketMachine2;
            this.ticketValidator2 = ticketValidator2;
            this.entryBarrier2    = entryBarrier2;
            this.exitBarrier2     = exitBarrier2;
        }
        /////////////////


        // 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();
            carPark         = new CarPark(ticketMachine, ticketValidator, fullSign, entryBarrier, exitBarrier);
            entrySensor     = new EntrySensor(carPark);
            exitSensor      = new ExitSensor(carPark);
            payStation      = new PayStation();

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

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



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


            lblEntrySensor.Text  = "False";
            lblEntryBarrier.Text = "False";
            lblExitSensor.Text   = "False";
            lblExitBarrier.Text  = "False";
            lblFullSign.Text     = "False";
            lstActiveTickets.Items.Clear(); //clears the active tickets list

            lblTicketMachine.Text   = "";
            lblTicketValidator.Text = "";



            UpdateDisplay();
        }
Esempio n. 9
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));
            }
        }
Esempio n. 10
0
        /////////////////


        // Operations ///
        private void ResetSystem(object sender, EventArgs e)
        {
            string input = Microsoft.VisualBasic.Interaction.InputBox("How many spaces does the car park have?", "Welcome", "5", -1, -1);
            int    spaces;

            if (!int.TryParse(input, out spaces))
            {
                MessageBox.Show("Invalid number of spaces!");
                return;
            }

            // 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();
            carPark         = new CarPark(ticketMachine, ticketValidator, fullSign, entryBarrier, exitBarrier, spaces);
            entrySensor     = new EntrySensor(carPark);
            exitSensor      = new ExitSensor(carPark);

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

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

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

            UpdateDisplay(true);
        }
Esempio n. 11
0
 public void TicketValidated(TicketValidator ticketValidator, Barrier exitBarrier, ActiveTickets activeTickets)
 {
     exitBarrier.Raise();
     ticketValidator.TicketEntered(activeTickets);
 }
Esempio n. 12
0
 public void CarArrivedAtExit(ExitSensor exitSensor, TicketValidator ticketValidator)
 {
     exitSensor.CarDetected();
     ticketValidator.CarArrived();
 }