private Button CreateSeatButton(Seat item)
        {
            Button btn = new Button();
            btn.Width = 28;
            btn.Height = 28;
            btn.Content = item;
            btn.Margin = new Thickness(3, 3, 3, 3);
            btn.Style = this.FindResource("SeatButtonStyle") as Style;
            btn.Click += new RoutedEventHandler(ButtonSeat_Click);

            if (show.IsSeatReserved(item) == true)
            {
                btn.IsEnabled = false;
            }

            return btn;
        }
        private void PopulateWithCells()
        {
            List<List<Button>> lsts = new List<List<Button>>();

            for (int i = 1; i < show.Hall.Rows; i++)
            {
                lsts.Add(new List<Button>());

                for (int j = 1; j < show.Hall.Seats; j++)
                {
                    Seat item = new Seat(i, j);
                    Button btn = CreateSeatButton(item);

                    lsts[i - 1].Add(btn);
                }
            }
            lst.ItemsSource = lsts;
        }
예제 #3
0
 public void CancelSeatReservation(Seat seat)
 {
     this.seatReserved[seat.Row, seat.SeatNo] = false;
 }
예제 #4
0
 public bool IsSeatReserved(Seat seat)
 {
     return this.seatReserved[seat.Row, seat.SeatNo];
 }
예제 #5
0
 public void ReserveSeat(Seat seat)
 {
     this.seatReserved[seat.Row, seat.SeatNo] = true;
 }