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; }
public void CancelSeatReservation(Seat seat) { this.seatReserved[seat.Row, seat.SeatNo] = false; }
public bool IsSeatReserved(Seat seat) { return this.seatReserved[seat.Row, seat.SeatNo]; }
public void ReserveSeat(Seat seat) { this.seatReserved[seat.Row, seat.SeatNo] = true; }