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();
            }
        }
示例#2
0
        private void UpdateDisplay()
        {
            if (entrySensor.IsCarOnSensor())
            {
                lblEntrySensor.Text = "True";      //entry sensor
            }

            else
            {
                lblEntrySensor.Text = "False";
            }

            if (entryBarrier.IsLifted())
            {
                lblEntryBarrier.Text = "True";     //entry barrier
            }
            else
            {
                lblEntryBarrier.Text = "False";
            }

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

            if (exitBarrier.IsLifted())
            {
                lblExitBarrier.Text = "True";          //exit barrier
            }

            else
            {
                lblExitBarrier.Text = "False";
            }

            if (fullSign.IsLit())
            {
                lblFullSign.Text = "True";             //fullsign
            }

            else
            {
                lblFullSign.Text = "False";
            }

            int spaces = carPark.GetCurrentSpaces();

            lblSpaces.Text = spaces.ToString();          //spaces

            if (carPark.IsFull())
            {
                btnCarArrivesAtEntrance.Visible = false;
            }
        }
        private void CarEntersCarPark(object sender, EventArgs e)
        {
            entrySensor.CarLeftSensor();
            btnCarArrivesAtEntrance.Visible = true;
            btnCarArrivesAtExit.Visible     = true;
            btnCarEntersCarPark.Visible     = false;

            if (carPark.GetCurrentSpaces() == 0)
            {
                btnCarArrivesAtEntrance.Visible = false;
            }
            if (exitSensor.IsCarOnSensor() == true || exitBarrier.IsLifted() == true)

            {
                btnCarArrivesAtExit.Visible = false;
            }
            UpdateDisplay();
        }
示例#4
0
 private void UpdateDisplay()
 {
     lblEntrySensor.Text     = "" + entrySensor.IsCarOnSensor();
     lblExitSensor.Text      = "" + exitSensor.IsCarOnSensor();
     lblEntryBarrier.Text    = "" + entryBarrier.IsLifted();
     lblExitBarrier.Text     = "" + exitBarrier.IsLifted();
     lblSpaces.Text          = "" + carPark.GetCurrentSpaces();
     lblFullSign.Text        = "" + fullSign.IsLit();
     lblTicketMachine.Text   = "" + ticketMachine.GetMessage();
     lblTicketValidator.Text = "" + ticketValidator.GetMessage();
 }
 private void CarExitsCarPark(object sender, EventArgs e)
 {
     exitSensor.CarLeftSensor();
     btnCarExitsCarPark.Visible      = false;
     btnCarArrivesAtEntrance.Visible = true;
     // if carOnSensor in EntrySensor is true or lifted in EntryBarrier is true then
     if (entrySensor.IsCarOnSensor() == true || entryBarrier.IsLifted() == true)
     {
         btnCarArrivesAtEntrance.Visible = false; // prevent any cars from arriving to the car park
     }
     if (carPark.GetCurrentSpaces() != 5)         // if the car park not empty, display btnCarArrivesAtExit
     {
         btnCarArrivesAtExit.Visible = false;
     }
     else
     {
         btnCarArrivesAtExit.Visible = false;     // if its empty, we have no cars to leave
     }
     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());
        }
示例#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;
            }
        }