private void UpdateDisplay()
        {
            lblEntryBarrier.Text    = Convert.ToString(entryBarrier.IsLifted());
            lblExitBarrier.Text     = Convert.ToString(exitBarrier.IsLifted());
            lblEntrySensor.Text     = Convert.ToString(entrySensor.isCarOnSensor());
            lblExitSensor.Text      = Convert.ToString(exitSensor.isCarOnSensor());
            lblFullSign.Text        = Convert.ToString(fullSign.isLit());
            lblSpaces.Text          = Convert.ToString(carPark.getCurrentSpaces());
            lblTicketMachine.Text   = Convert.ToString(ticketMachine.getMessage());
            lblTicketValidator.Text = Convert.ToString(ticketValidator.getMessage());

            if (activeTickets.GetTickets().Count != 0)
            {
                lstActiveTickets.Items.Clear();

                for (int i = 0; i < activeTickets.GetTickets().Count; i++)
                {
                    lstActiveTickets.Items.Add(activeTickets.GetTickets()[i].getName());
                }
            }
            else
            {
                lstActiveTickets.Items.Clear();
            }
        }
Exemple #2
0
        private void UpdateDisplay()
        {
            if (entryBarrier.isLifted() == true)
            {
                lblEntryBarrier.Text = "True";
            }
            else
            {
                lblEntryBarrier.Text = "False";
            }

            if (entrySensor.IsCarOnSensor() == true)
            {
                lblEntrySensor.Text = "True";
            }
            else
            {
                lblEntrySensor.Text = "False";
            }

            if (exitBarrier.isLifted() == true)
            {
                lblExitBarrier.Text = "True";
            }
            else
            {
                lblExitBarrier.Text = "False";
            }

            if (exitSensor.IsCarOnSensor() == true)
            {
                lblExitSensor.Text = "True";
            }
            else
            {
                lblExitSensor.Text = "False";
            }

            if (fullSign.isLit() == true)
            {
                lblFullSign.Text = "True";
            }
            else
            {
                lblFullSign.Text = "False";
            }
            lblSpaces.Text = Convert.ToString(carPark.GetCurrentSpaces());

            lblTicketMachine.Text   = ticketMachine.GetMessage();
            lblTicketValidator.Text = ticketValidator.GetMessage();


            lstActiveTickets.Items.Clear();
            List <Ticket> tickets = activeTickets.GetTickets();

            foreach (Ticket ticket in tickets)
            {
                lstActiveTickets.Items.Add(Convert.ToString("#" + ticket.ticketNumber() + ":" + ticket.IsPaid()));
            }
        }
        private void DriverEntersTicket(object sender, EventArgs e)
        {
            int ticketCode = activeTickets.GetTickets()[0].GetHashCode();

            ticketValidator.TicketEntered(ticketCode);
            UpdateDisplay();
        }
        private void DriverPressesForTicket(object sender, EventArgs e)
        {
            ticketMachine.PrintTicket(activeTickets, carPark);
            lblTicketMachine.Text = ticketMachine.GetMessage("Thank you, enjoy your stay");
            lstActiveTickets.Items.Add(activeTickets.GetTickets());
            btnDriverPressesForTicket.Visible = false;
            btnCarEntersCarPark.Visible       = true;

            UpdateDisplay();
        }
        private void UpdateDisplay()
        {
            lblEntrySensor.Text   = entrySensor.IsCarOnSensor().ToString();
            lblTicketMachine.Text = ticketMachine.Message;
            lblEntryBarrier.Text  = entryBarrier.IsLifted().ToString();

            lblExitSensor.Text      = exitSensor.IsCarOnSensor().ToString();
            lblTicketValidator.Text = ticketValidator.Message;
            lblExitBarrier.Text     = exitBarrier.IsLifted().ToString();

            lblFullSign.Text = fullSign.Lit.ToString();
            lblSpaces.Text   = carPark.CurrentSpaces.ToString();

            lstActiveTickets.Items.Clear();
            lstActiveTickets.Items.AddRange(activeTickets.GetTickets());
        }
 public void payForTicket()
 {
     ticketPay.GetTickets().SetPaid(true);      // gets the top ticket and sets the bool SetPaid to true
     message = "Ticket has been paid";
 }
Exemple #7
0
        private void UpdateDisplay(bool updateTicketList)
        {
            lblTicketMachine.Text   = ticketMachine.GetMessage();
            lblTicketValidator.Text = ticketValidator.GetMessage();
            lblEntrySensor.Text     = entrySensor.IsCarOnSensor().ToString();
            lblEntryBarrier.Text    = entryBarrier.IsLifted().ToString();
            lblExitSensor.Text      = exitSensor.IsCarOnSensor().ToString();
            lblExitBarrier.Text     = exitBarrier.IsLifted().ToString();
            lblFullSign.Text        = fullSign.IsLit().ToString();
            lblSpaces.Text          = carPark.GetCurrentSpaces().ToString();

            if (updateTicketList)
            {
                lstActiveTickets.Items.Clear();

                foreach (Ticket t in activeTickets.GetTickets())
                {
                    lstActiveTickets.Items.Add("#" + t.getID() + " : " + t.IsPaid());
                }
            }

            if (lstActiveTickets.SelectedItem != null)
            {
                btnInsertTicket.Visible = true;
            }

            if (btnDriverPressesForTicket.Visible == true)
            {
                btnCarArrivesAtEntrance.Visible = false;
                btnCarEntersCarPark.Visible     = false;
            }

            if (btnCarEntersCarPark.Visible == true)
            {
                btnCarArrivesAtEntrance.Visible   = false;
                btnDriverPressesForTicket.Visible = false;
            }

            if (btnInsertCoins.Visible == true)
            {
                btnInsertTicket.Visible = false;
            }

            if (panelPayment.Visible == true)
            {
                btnInsertCoins.Visible = false;
            }

            if (btnDriverEntersTicket.Visible == true)
            {
                btnCarArrivesAtExit.Visible = false;
                btnCarExitsCarPark.Visible  = false;
            }

            if (btnCarExitsCarPark.Visible == true)
            {
                btnCarArrivesAtExit.Visible   = false;
                btnDriverEntersTicket.Visible = false;
            }

            if (carPark.GetCurrentSpaces() == 0)
            {
                btnCarArrivesAtEntrance.Visible = false;
            }
        }