private void CarExitsCarPark(object sender, EventArgs e) { exitSensor.CarLeftSensor(carPark); if (!exitSensor.IsCarOnSensor()) { lblTicketValidator.Text = ticketValidator.ClearMessage(""); if (carPark.IsFull()) { fullSign.SetLit(1); } else { fullSign.SetLit(0); } btnCarExitsCarPark.Visible = false; if (carPark.GetCurrentSpaces() < 5) { btnCarArrivesAtExit.Visible = true; } if (carPark.HasSpace() && ((!btnCarEntersCarPark.Visible) || (!btnDriverPressesForTicket.Visible) || (!btnCarArrivesAtEntrance.Visible))) { btnCarArrivesAtEntrance.Visible = true; } } UpdateDisplay(); }
private void CarArrivesAtExit(object sender, EventArgs e) { carPark.CarArrivedAtExit(); exitSensor.CarDetected(); btnCarArrivesAtExit.Visible = false; btnDriverEntersTicket.Visible = true; if (carPark.GetCurrentSpaces() == 4) { btnCarArrivesAtExit2.Visible = false; btnDriverEntersTicket2.Visible = false; HideBottom(); } UpdateDisplay(); }
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 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(); }
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 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()); }
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; } }