Ejemplo n.º 1
0
        public void SetupSeatingButtons(Room room, Ticket activeTicket)
        {
            int index = 0;

            Seating[] seatings = SeatingManager.GetAllSeating();
            if (room != null)
            {
                labelSelectSeating.Content = Strings.SelectSeating + ": " + room.Description;
                foreach (Seating seat in seatings)
                {
                    if (index < Buttons.Length)
                    {
                        if (seat.RoomId == room.Id)
                        {
                            AssignSeatingIdToButton(Buttons[index], seat.Id);
                            Buttons[index].Text       = Helpers.StringHelper.ThinString(seat.Description);
                            Buttons[index].Visibility = Visibility.Visible;
                            Buttons[index].IsChecked  = ((activeTicket != null) && (activeTicket.SeatingId == seat.Id));
                            index++;
                        }
                    }
                }
            }
            else
            {
                labelSelectSeating.Content = Strings.SEATINGISNOTSETUP;
            }
            HideRemainingButtons(index);
        }
Ejemplo n.º 2
0
 private void InitializeListBox()
 {
     listBox1.SelectedItem = null;
     listBox1.Items.Clear();
     if (ViewMode == SeatingViewMode.Rooms)
     {
         roomEditorControl.SelectedRoom = null;
         FormattedListBoxItem selected = null;
         Room[] rooms = SeatingManager.GetAllRoom();
         foreach (Room room in rooms)
         {
             FormattedListBoxItem item =
                 new FormattedListBoxItem(room, room.Description, true);
             if ((SelectedRoom != null) && (SelectedRoom.Id == room.Id))
             {
                 selected = item;
             }
             listBox1.Items.Add(item);
         }
         listBox1.SelectedItem = selected;
         if (selected != null)
         {
             roomEditorControl.SelectedRoom        =
                 seatingEditorControl.SelectedRoom =
                     selected.ReferenceObject as Room;
         }
         SetEditMode(false);
     }
     else
     {
         if (SelectedRoom != null)
         {
             seatingEditorControl.SelectedSeating = null;
             FormattedListBoxItem  selected = null;
             IEnumerable <Seating> seatings = SeatingManager.GetAllSeating(SelectedRoom.Id);
             foreach (Seating seating in seatings)
             {
                 FormattedListBoxItem item =
                     new FormattedListBoxItem(seating, seating.Description, true);
                 if ((SelectedSeating != null) && (SelectedSeating.Id == seating.Id))
                 {
                     selected = item;
                 }
                 listBox1.Items.Add(item);
             }
             listBox1.SelectedItem = selected;
             if (selected != null)
             {
                 seatingEditorControl.SelectedSeating =
                     selected.ReferenceObject as Seating;
             }
             SetEditMode(false);
         }
     }
 }