Пример #1
0
        /// <summary>
        /// The button to admit the guest.
        /// </summary>
        /// <param name="sender"> Not available.</param>
        /// <param name="e"> The parameter is not used.</param>
        private void admitGuestButton_Click(object sender, RoutedEventArgs e)
        {
            // Create a guest.
            Guest guest = new Guest("Ethel", 42, 30, "Salmon");

            // Sell the ticket to the guest.
            BoothItems.Ticket ticket = this.comoZoo.SellTicket(guest);
        }
Пример #2
0
        /// <summary>
        /// The button to admit the guest.
        /// </summary>
        /// <param name="sender"> Not available.</param>
        /// <param name="e"> The parameter is not used.</param>
        private void admitGuestButton_Click(object sender, RoutedEventArgs e)
        {
            // Create a guest.
            Guest guest = new Guest("Ethel", 42, 30, "Salmon");

            // Sell the ticket to the guest.
            BoothItems.Ticket ticket = this.zoo.SellTicket(guest);

            try
            {
                this.zoo.AddGuest(guest, ticket);
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show(ex.Message);
            }

            this.PopulateGuestListBox();
        }