// 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();
        }
        /////////////////


        // 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);
            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();
        }
Beispiel #4
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);
        }
Beispiel #5
0
 public void CarExitedCarPark(Barrier exitBarrier, TicketValidator ticketValidator, ExitSensor exitSensor, FullSign fullSign)
 {
     exitSensor.CarLeftSensor();
     exitBarrier.Lower();
     ticketValidator.ClearMessage();
     if (IsFull() == true)
     {
         fullSign.SetLit();
     }
     currentSpaces++;
 }
Beispiel #6
0
 public void CarArrivedAtExit(ExitSensor exitSensor, TicketValidator ticketValidator)
 {
     exitSensor.CarDetected();
     ticketValidator.CarArrived();
 }