コード例 #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();
            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();
        }
コード例 #2
0
 public TicketMachine(ActiveTickets activeTickets, ActivePrePaid activePrePaidTickets)
 {
     this.activeTickets        = activeTickets;
     this.activePrePaidTickets = activePrePaidTickets;
 }
コード例 #3
0
 public TicketValidator(ActiveTickets activeTickets, ActivePrePaid activePrePaidTickets)
 {
     this.activeTickets        = activeTickets;
     this.activePrePaidTickets = activePrePaidTickets;
 }