Exemplo n.º 1
0
        private void UpdateDisplay()
        {
            lblEmergencyVehicles.Text = Convert.ToString(carPark.GetNoEmergVehicles());
            lblEmergencySign.Text     = Convert.ToString(value: carPark.emergency);
            lblEntrySensor.Text       = Convert.ToString(entrySensor.isCarOnSensor());
            lblEntryBarrier.Text      = Convert.ToString(entryBarrier.IsLifted());
            lblExitSensor.Text        = Convert.ToString(exitSensor.isCarOnSensor());
            lblExitBarrier.Text       = Convert.ToString(exitBarrier.IsLifted());
            lblFullSign.Text          = Convert.ToString(fullSign.IsLit());
            lblFloor2Spaces.Text      = Convert.ToString(carPark.GetCurrentPrePaidSpaces());
            lblFloor0Spaces.Text      = Convert.ToString(carPark.GetCurrentSpaces());
            lblTicketMachine.Text     = Convert.ToString(ticketMachine.GetMessage());
            lblTicketValidator.Text   = Convert.ToString(ticketValidator.GetMessage());
            lstActiveTickets.Items.Clear();
            lstPrePaidTickets.Items.Clear();

            if (carPark.emergency)
            {
                if (entrySensor.isCarOnSensor() && entryBarrier.IsLifted())
                {
                    btnVehicleEnters.Visible     = true;
                    btnPrePaidEnters.Visible     = false;
                    btnNormalEntrance.Visible    = false;
                    btnPrePaidEntrance.Visible   = false;
                    btnEmergencyEntrance.Visible = false;
                }
                else if (entrySensor.isCarOnSensor())
                {
                    btnEmergencyEntrance.Visible      = true;
                    btnVehicleArrivesEntrance.Visible = false;
                }
                else
                {
                    btnVehicleArrivesEntrance.Visible = true;
                    btnVehicleEnters.Visible          = false;
                    btnPrePaidEnters.Visible          = false;
                }
            }
            else
            {
                if (!carPark.IsFull())
                {
                    if (entrySensor.isCarOnSensor() && entryBarrier.IsLifted())
                    {
                        btnVehicleEnters.Visible     = true;
                        btnPrePaidEnters.Visible     = false;
                        btnNormalEntrance.Visible    = false;
                        btnPrePaidEntrance.Visible   = false;
                        btnEmergencyEntrance.Visible = false;
                    }
                    else if (entrySensor.isCarOnSensor())
                    {
                        btnPrePaidEntrance.Visible        = true;
                        btnNormalEntrance.Visible         = true;
                        btnVehicleArrivesEntrance.Visible = false;
                        btnEmergencyEntrance.Visible      = true;
                    }
                    else
                    {
                        btnVehicleArrivesEntrance.Visible = true;
                        btnVehicleEnters.Visible          = false;
                        btnPrePaidEnters.Visible          = false;
                    }
                }
                else
                {
                    btnVehicleEnters.Visible = false;
                }

                //btnVehicleEnters.Visible = false;
                // btnPrePaidEnters.Visible = false;
            }


            if (!carPark.IsEmpty())
            {
                if (exitSensor.isCarOnSensor() && exitBarrier.IsLifted())
                {
                    if (carPark.emergency)
                    {
                        btnVehicleExits.Visible = true;
                    }
                    else
                    {
                        btnVehicleExits.Visible = true;
                        btnPrePaidExits.Visible = true;
                    }
                    btnNormalExit.Visible    = false;
                    btnPrePaidExit.Visible   = false;
                    btnEmergencyExit.Visible = false;
                }
                else if (exitSensor.isCarOnSensor())
                {
                    if (!carPark.emergency)
                    {
                        btnNormalExit.Visible  = true;
                        btnPrePaidExit.Visible = true;
                    }
                    else
                    {
                        btnEmergencyExit.Visible = true;
                    }
                    btnVehicleArrivesExit.Visible = false;
                }
                else
                {
                    btnVehicleArrivesExit.Visible = true;
                    btnVehicleExits.Visible       = false;
                    btnPrePaidExits.Visible       = false;
                }
            }
            else
            {
                btnVehicleExits.Visible = false;
                btnPrePaidExits.Visible = false;
            }


            foreach (var ticket in activeTickets.GetTickets())
            {
                lstActiveTickets.Items.Add("#" + ticket.GetHashCode() + ": " + ticket.IsPaid());
            }

            foreach (var ticket in activePrePaidTickets.GetTickets())
            {
                lstPrePaidTickets.Items.Add("#" + ticket.GetHashCode() + ": " + ticket.InCarPark());
            }
        }
Exemplo n.º 2
0
 public void PrePaidChecked()
 {
     message = "Please park on floor 2 in space: " + Convert.ToString((carPark.GetMaxPrePaidSpaces() - carPark.GetCurrentPrePaidSpaces()) + 1);
     carPark.PrePaidChecked();
 }