コード例 #1
0
        private void btnDriverEntersTicket2_Click(object sender, EventArgs e)
        {
            if (lstActiveTickets.SelectedIndex != -1)
            {
                string ticket  = lstActiveTickets.SelectedItem.ToString();
                int    index   = lstActiveTickets.Items.IndexOf(ticket);
                bool   ispaid2 = activeTickets.IsTicketPayed(index);

                if (ispaid2 == true)
                {
                    carPark.TicketValidated2();
                    btnDriverEntersTicket2.Visible = false;
                    btnCarExitsCarPark2.Visible    = true;
                }
                else
                {
                    btnDriverEntersTicket2.Visible = false;
                    btnCarArrivesAtExit2.Visible   = true;
                    carPark.CarArrivedAtExit2();
                    ticketValidator2.TicketPaidFor();
                    if (carPark.GetCurrentSpaces() == 4)
                    {
                        btnCarArrivesAtExit2.Visible   = false;
                        btnDriverEntersTicket2.Visible = false;
                        HideTop();
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select a ticket from the list");
                btnCarArrivesAtExit2.Visible   = true;
                btnDriverEntersTicket2.Visible = false;
            }
            UpdateDisplay();
        }