Example #1
0
        public AirlinerClassMVVM(AirlinerClass type, int seating, int regularSeating, int maxseats, Boolean changeableSeats = false)
        {
            this.Type    = type.Type;
            this.Seating = seating;
            this.RegularSeatingCapacity = regularSeating;
            this.ChangeableSeats        = changeableSeats;
            this.MaxSeats         = maxseats;
            this.MaxSeatsCapacity = maxseats;
            this.ChangedFacility  = false;

            this.Facilities = new ObservableCollection <AirlinerFacilityMVVM>();

            foreach (AirlinerFacility.FacilityType facType in Enum.GetValues(typeof(AirlinerFacility.FacilityType)))
            {
                AirlinerFacilityMVVM facility = new AirlinerFacilityMVVM(facType, this);

                foreach (AirlinerFacility fac in AirlinerFacilities.GetFacilities(facType))
                {
                    facility.Facilities.Add(fac);
                }


                AirlinerFacility selectedFacility = type.getFacility(facType) == null?AirlinerFacilities.GetBasicFacility(facType) : type.getFacility(facType);

                facility.SelectedFacility = selectedFacility;

                this.Facilities.Add(facility);
            }
        }
Example #2
0
        public AirlinerClassMVVM(AirlinerClass.ClassType type, int seating, Boolean canDelete)
        {
            this.CanDelete      = canDelete;
            this.Type           = type;
            this.Seating        = seating;
            this.RegularSeating = seating;
            this.Facilities     = new ObservableCollection <AirlinerClassFacilityMVVM>();

            foreach (AirlinerFacility.FacilityType facType in Enum.GetValues(typeof(AirlinerFacility.FacilityType)))
            {
                AirlinerClassFacilityMVVM facility = new AirlinerClassFacilityMVVM(facType);

                foreach (AirlinerFacility fac in AirlinerFacilities.GetFacilities(facType))
                {
                    facility.Facilities.Add(fac);
                }


                this.Facilities.Add(facility);
            }
        }
Example #3
0
        public PopUpAirlinerFacility(AirlinerClass airlinerClass, AirlinerFacility.FacilityType type)
        {
            InitializeComponent();

            this.AirlinerClass = airlinerClass;
            this.Type          = type;

            this.Title = "Select " + type.ToString().ToLower();

            this.Width = 400;

            this.Height = 120;

            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            StackPanel mainPanel = new StackPanel();

            mainPanel.Margin = new Thickness(10, 10, 10, 10);

            cbFacility = new ComboBox();
            cbFacility.ItemTemplate = this.Resources["AirlinerFacilityItem"] as DataTemplate;
            cbFacility.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");

            foreach (AirlinerFacility facility in AirlinerFacilities.GetFacilities(this.Type, GameObject.GetInstance().GameTime.Year))
            {
                cbFacility.Items.Add(facility);
            }

            cbFacility.SelectedItem = this.AirlinerClass.getFacility(this.Type);

            mainPanel.Children.Add(cbFacility);

            mainPanel.Children.Add(createButtonsPanel());

            this.Content = mainPanel;
            // int serviceLevel, double percentOfSeats, double pricePerSeat
        }