public AirlinerTypeConfiguration(string name, AirlinerType type, Period<DateTime> period, Boolean standard)
     : base(Configuration.ConfigurationType.AirlinerType, name, standard)
 {
     this.Airliner = type;
     this.Period = period;
     this.Classes = new List<AirlinerClassConfiguration>();
 }
 public AirlinerTypeConfiguration(string name, AirlinerType type, Period <DateTime> period, Boolean standard)
     : base(Configuration.ConfigurationType.AirlinerType, name, standard)
 {
     this.Airliner = type;
     this.Period   = period;
     this.Classes  = new List <AirlinerClassConfiguration>();
 }
 public ScenarioAirlineRoute(Airport destination1, Airport destination2, AirlinerType airlinertype, int quantity)
 {
     this.Destination1 = destination1;
     this.Destination2 = destination2;
     this.AirlinerType = airlinertype;
     this.Quantity = quantity;
 }
예제 #4
0
 public AirlinerOrder(AirlinerType type, List<AirlinerClass> classes, int amount, Boolean customConfiguration)
 {
     this.Type = type;
     this.Amount = amount;
     this.Classes = classes;
     this.CustomConfiguration = customConfiguration;
 }
예제 #5
0
        public Airliner(string id, AirlinerType type, string tailNumber, DateTime builtDate)
        {
            this.ID = id;
            this.BuiltDate = new DateTime(builtDate.Year, builtDate.Month, builtDate.Day);
            this.Type = type;
            this.LastServiceCheck = 0;
            this.TailNumber = tailNumber;
            this.Flown = 0;
            this.Condition = rnd.Next(90, 100);
            this.Classes = new List<AirlinerClass>();

            if (this.Type.TypeAirliner == AirlinerType.TypeOfAirliner.Passenger)
            {
                AirlinerClass aClass = new AirlinerClass(AirlinerClass.ClassType.Economy_Class, ((AirlinerPassengerType)this.Type).MaxSeatingCapacity);
                aClass.createBasicFacilities(this.Airline);
                this.Classes.Add(aClass);
            }

            if (this.Type.TypeAirliner == AirlinerType.TypeOfAirliner.Cargo)
            {
                AirlinerClass aClass = new AirlinerClass(AirlinerClass.ClassType.Economy_Class, 0);
                aClass.createBasicFacilities(this.Airline);
                this.Classes.Add(aClass);

            }
        }
예제 #6
0
 public AirlinerOrder(AirlinerType type, List <AirlinerClass> classes, int amount, Boolean customConfiguration)
 {
     this.Type                = type;
     this.Amount              = amount;
     this.Classes             = classes;
     this.CustomConfiguration = customConfiguration;
 }
예제 #7
0
        public Airliner(string id, AirlinerType type, string tailNumber, DateTime builtDate)
        {
            this.ID               = id;
            this.BuiltDate        = new DateTime(builtDate.Year, builtDate.Month, builtDate.Day);
            this.Type             = type;
            this.LastServiceCheck = 0;
            this.TailNumber       = tailNumber;
            this.Flown            = 0;
            this.Condition        = rnd.Next(90, 100);
            this.Classes          = new List <AirlinerClass>();

            if (this.Type.TypeAirliner == AirlinerType.TypeOfAirliner.Passenger)
            {
                AirlinerClass aClass = new AirlinerClass(AirlinerClass.ClassType.Economy_Class, ((AirlinerPassengerType)this.Type).MaxSeatingCapacity);
                aClass.createBasicFacilities(this.Airline);
                this.Classes.Add(aClass);
            }

            if (this.Type.TypeAirliner == AirlinerType.TypeOfAirliner.Cargo)
            {
                AirlinerClass aClass = new AirlinerClass(AirlinerClass.ClassType.Economy_Class, 0);
                aClass.createBasicFacilities(this.Airline);
                this.Classes.Add(aClass);
            }
        }
        public PopUpAirlinerConfiguration(AirlinerType type, List<AirlinerClass> classes)
        {
            this.Classes = new List<AirlinerClass>(classes);

            this.Type = type;

            createPopUp();
        }
예제 #9
0
        //creates an airliner for an airline
        public static FleetAirliner CreateAirliner(Airline airline, AirlinerType type)
        {
            Guid id = Guid.NewGuid();

            Airliner airliner = new Airliner(id.ToString(), type, airline.Profile.Country.TailNumbers.getNextTailNumber(), GameObject.GetInstance().GameTime);
            Airliners.AddAirliner(airliner);

            FleetAirliner fAirliner = new FleetAirliner(FleetAirliner.PurchasedType.Bought, GameObject.GetInstance().GameTime, airline, airliner, airline.Airports[0]);

            airliner.clearAirlinerClasses();

            AirlinerHelpers.CreateAirlinerClasses(airliner);

            return fAirliner;

        }
        public AirlinerOrderMVVM(AirlinerType type, int amount = 1)
        {
            this.Type = type;
            this.Amount = amount;
            this.Classes = new List<AirlinerClass>();
            this.Homebases = new List<Airport>();

            if (this.Type.TypeAirliner == AirlinerType.TypeOfAirliner.Passenger)
            {
                AirlinerClass eClass = new AirlinerClass(AirlinerClass.ClassType.Economy_Class, ((AirlinerPassengerType)type).MaxSeatingCapacity);
                eClass.createBasicFacilities(null);
                this.Classes.Add(eClass);
            }

            long minRequiredRunway = this.Type.MinRunwaylength;

            foreach (var homebase in GameObject.GetInstance().HumanAirline.Airports.FindAll(a => a.getCurrentAirportFacility(GameObject.GetInstance().HumanAirline, AirportFacility.FacilityType.Service).TypeLevel > 0 && a.getMaxRunwayLength() >= minRequiredRunway))
                this.Homebases.Add(homebase);
        }
예제 #11
0
        public PopUpAirlinerImage(AirlinerType type)
        {
            this.Type = type;

            InitializeComponent();

            this.Width = 700;

            this.Height = 260;
            this.Title = type.Name;

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

            Image imgMap = new Image();
            imgMap.Width = 700;
            imgMap.Height = 240;
            imgMap.Source = new BitmapImage(new Uri(this.Type.Image, UriKind.RelativeOrAbsolute));
            RenderOptions.SetBitmapScalingMode(imgMap, BitmapScalingMode.HighQuality);

            this.Content = imgMap;
        }
예제 #12
0
        public static TimeSpan GetMinTimeBetweenFlights(AirlinerType type)
        {
            if (type == null || type is AirlinerCargoType)
                return GetMinTimeBetweenFlights(0);

            return GetMinTimeBetweenFlights(((AirlinerPassengerType)type).MaxSeatingCapacity);
        }
예제 #13
0
 public AirlinerTypeMVVM(AirlinerType type)
 {
     this.Type = type;
     this.IsSelected = false;
 }
예제 #14
0
        public AirlinerOrderMVVM(AirlinerType type, AirlinerOrdersMVVM order, int amount = 1)
        {
            this.Type = type;
            this.Order = order;
            this.Amount = amount;
            this._classes = new List<AirlinerClass>();
            this.Homebases = new List<Airport>();

            if (this.Type.TypeAirliner == AirlinerType.TypeOfAirliner.Passenger)
            {
                AirlinerClass eClass = new AirlinerClass(AirlinerClass.ClassType.Economy_Class, ((AirlinerPassengerType)type).MaxSeatingCapacity);
                eClass.createBasicFacilities(null);
                this.Classes.Add(eClass);
            }

            long minRunway = this.Type.MinRunwaylength;

            //var homebases = GameObject.GetInstance().HumanAirline.Airports.FindAll(a => (a.hasContractType(GameObject.GetInstance().HumanAirline, AirportContract.ContractType.Full_Service) || a.getCurrentAirportFacility(GameObject.GetInstance().HumanAirline, AirportFacility.FacilityType.Service).TypeLevel > 0) && a.getMaxRunwayLength() >= minRunway);

            var homebases = AirlineHelpers.GetHomebases(GameObject.GetInstance().HumanAirline, minRunway);

            foreach (var homebase in homebases)
                this.Homebases.Add(homebase);
        }
        public PopUpAirlinerConfiguration(Airliner airliner)
        {
            this.Classes = new List<AirlinerClass>();

            foreach (AirlinerClass aClass in airliner.Classes)
            {
                this.Classes.Add(aClass);
            }

            this.Type = airliner.Type;

            createPopUp();
        }
예제 #16
0
        //returns the airliner classes for an airliner
        public static List<AirlinerClass> GetAirlinerClasses(AirlinerType type)
        {
            List<AirlinerClass> classes = new List<AirlinerClass>();

            if (type is AirlinerPassengerType)
            {
                Configuration airlinerTypeConfiguration = Configurations.GetConfigurations(Configuration.ConfigurationType.AirlinerType).Find(c => ((AirlinerTypeConfiguration)c).Airliner == type && ((AirlinerTypeConfiguration)c).Period.From <= GameObject.GetInstance().GameTime && ((AirlinerTypeConfiguration)c).Period.To > GameObject.GetInstance().GameTime);

                if (airlinerTypeConfiguration == null)
                {

                    AirlinerConfiguration configuration = null;

                    int numOfClasses = rnd.Next(0, ((AirlinerPassengerType)type).MaxAirlinerClasses) + 1;

                    if (GameObject.GetInstance().GameTime.Year >= (int)AirlinerClass.ClassType.Business_Class)
                    {
                        if (numOfClasses == 1)
                            configuration = (AirlinerConfiguration)Configurations.GetStandardConfiguration("200");
                        if (numOfClasses == 2)
                            configuration = (AirlinerConfiguration)Configurations.GetStandardConfiguration("202");
                        if (numOfClasses == 3)
                            configuration = (AirlinerConfiguration)Configurations.GetStandardConfiguration("203");
                    }
                    else
                    {
                        if (numOfClasses == 1)
                            configuration = (AirlinerConfiguration)Configurations.GetStandardConfiguration("200");
                        if (numOfClasses == 2)
                            configuration = (AirlinerConfiguration)Configurations.GetStandardConfiguration("201");
                        if (numOfClasses == 3)
                            configuration = (AirlinerConfiguration)Configurations.GetStandardConfiguration("201");

                    }

                    foreach (AirlinerClassConfiguration aClass in configuration.Classes)
                    {
                        AirlinerClass airlinerClass = new AirlinerClass(aClass.Type, aClass.SeatingCapacity);
                        airlinerClass.RegularSeatingCapacity = aClass.RegularSeatingCapacity;

                        foreach (AirlinerFacility facility in aClass.getFacilities())
                            airlinerClass.setFacility(null, facility);

                        foreach (AirlinerFacility.FacilityType fType in Enum.GetValues(typeof(AirlinerFacility.FacilityType)))
                        {
                            if (!aClass.Facilities.Exists(f => f.Type == fType))
                            {
                                airlinerClass.setFacility(null, AirlinerFacilities.GetBasicFacility(fType));
                            }
                        }

                        airlinerClass.SeatingCapacity = Convert.ToInt16(Convert.ToDouble(airlinerClass.RegularSeatingCapacity) / airlinerClass.getFacility(AirlinerFacility.FacilityType.Seat).SeatUses);

                        classes.Add(airlinerClass);
                    }

                    int seatingDiff = ((AirlinerPassengerType)type).MaxSeatingCapacity - configuration.MinimumSeats;

                    AirlinerClass economyClass = classes.Find(c => c.Type == AirlinerClass.ClassType.Economy_Class);
                    economyClass.RegularSeatingCapacity += seatingDiff;

                    AirlinerFacility seatingFacility = economyClass.getFacility(AirlinerFacility.FacilityType.Seat);

                    int extraSeats = (int)(seatingDiff / seatingFacility.SeatUses);

                    economyClass.SeatingCapacity += extraSeats;
                }
                else
                {

                    foreach (AirlinerClassConfiguration aClass in ((AirlinerTypeConfiguration)airlinerTypeConfiguration).Classes)
                    {
                        AirlinerClass airlinerClass = new AirlinerClass(aClass.Type, aClass.SeatingCapacity);
                        airlinerClass.RegularSeatingCapacity = aClass.RegularSeatingCapacity;

                        foreach (AirlinerFacility facility in aClass.getFacilities())
                            airlinerClass.setFacility(null, facility);

                        airlinerClass.SeatingCapacity = Convert.ToInt16(Convert.ToDouble(airlinerClass.RegularSeatingCapacity) / airlinerClass.getFacility(AirlinerFacility.FacilityType.Seat).SeatUses);

                        classes.Add(airlinerClass);
                    }

                }
            }
            else if (type is AirlinerCargoType)
            {

                AirlinerClass cargoClass = new AirlinerClass(AirlinerClass.ClassType.Economy_Class, 0);
                classes.Add(cargoClass);
            }

            return classes;
        }
예제 #17
0
 //removes an airliner type
 public static void RemoveType(AirlinerType type)
 {
     types.Remove(type);
 }
 public AirlineFleetSizeMVVM(AirlinerType type, int count)
 {
     this.Type = type;
     this.Count = count;
 }
예제 #19
0
 //adds an airliner type which fits this engine
 public void addAirlinerType(AirlinerType type)
 {
     this.Types.Add(type);
 }
예제 #20
0
 //adds an airliner type to the list
 public static void AddType(AirlinerType type)
 {
     types.Add(type);
 }
        //creates the panel for how the airline should be equipped
        private StackPanel createEquippedPanel(AirlinerType type)
        {
            this.Type = type;

            StackPanel panelEquipped = new StackPanel();
            panelEquipped.Margin = new Thickness(0, 5, 0, 0);

            TextBlock txtOrders = new TextBlock();
            txtOrders.FontWeight = FontWeights.Bold;
            txtOrders.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtOrders.Uid = "1012";
            txtOrders.Text = Translator.GetInstance().GetString("PageOrderAirliners", txtOrders.Uid);

            panelEquipped.Children.Add(txtOrders);

            ListBox lbEquipped = new ListBox();
            lbEquipped.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbEquipped.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");

            panelEquipped.Children.Add(lbEquipped);

            this.Classes.Clear();

            AirlinerClass eClass = new AirlinerClass(AirlinerClass.ClassType.Economy_Class, ((AirlinerPassengerType)type).MaxSeatingCapacity);
            eClass.createBasicFacilities(null);
            this.Classes.Add(eClass);

            panelClasses = new WrapPanel();

            foreach (AirlinerClass aClass in this.Classes)
            {
                panelClasses.Children.Add(createAirlineClassLink(aClass));
            }

            lbEquipped.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageOrderAirliners", "1012"), panelClasses));

            Configuration airlinerTypeConfiguration = Configurations.GetConfigurations(Configuration.ConfigurationType.AirlinerType).Find(c => ((AirlinerTypeConfiguration)c).Airliner == type && ((AirlinerTypeConfiguration)c).Period.From <= GameObject.GetInstance().GameTime && ((AirlinerTypeConfiguration)c).Period.To > GameObject.GetInstance().GameTime);

            if (airlinerTypeConfiguration != null)
            {
                CheckBox cbStandardConfiguration = new CheckBox();
                cbStandardConfiguration.Checked += cbStandardConfiguration_Checked;
                cbStandardConfiguration.Unchecked += cbStandardConfiguration_Unchecked;
                cbStandardConfiguration.Tag = type;

                lbEquipped.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageOrderAirliners", "1013"), cbStandardConfiguration));
            }

            WrapPanel panelConfiguration = new WrapPanel();
            panelEquipped.Margin = new Thickness(0, 5, 0, 0);
            panelEquipped.Children.Add(panelConfiguration);

            btnEquipped = new Button();
            btnEquipped.Uid = "201";
            btnEquipped.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnEquipped.Height = Double.NaN;
            btnEquipped.Width = Double.NaN;
            btnEquipped.Content = Translator.GetInstance().GetString("PageOrderAirliners", btnEquipped.Uid);
            btnEquipped.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnEquipped.Click += btnEquipped_Click;
            btnEquipped.Tag = type;
            btnEquipped.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

            panelConfiguration.Children.Add(btnEquipped);

            btnApplyConfiguration = new Button();
            btnApplyConfiguration.Uid = "202";
            btnApplyConfiguration.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnApplyConfiguration.Height = Double.NaN;
            btnApplyConfiguration.Width = Double.NaN;
            btnApplyConfiguration.Margin = new Thickness(5, 0, 0, 0);
            btnApplyConfiguration.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnApplyConfiguration.Content = Translator.GetInstance().GetString("PageOrderAirli ners", btnApplyConfiguration.Uid);
            btnApplyConfiguration.Visibility = System.Windows.Visibility.Collapsed;

            panelConfiguration.Children.Add(btnApplyConfiguration);

            return panelEquipped;
        }
        public RoutePlannerItemMVVM(Route route, AirlinerType type)
        {
            this.Route = route;

            Guid g2 = new Guid(this.Route.Id);

            byte[] bytes = g2.ToByteArray();

            byte red = bytes[0];
            byte green = bytes[1];
            byte blue = bytes[2];

            SolidColorBrush brush = new SolidColorBrush(Color.FromRgb(red, green, blue));
            brush.Opacity = 0.4;

            this.Brush = brush;
            this.FlightTime = MathHelpers.GetFlightTime(this.Route.Destination1, this.Route.Destination2, type);
        }
예제 #23
0
        //creates the quick info panel for a airliner type
        public static StackPanel createQuickInfoPanel(AirlinerType airliner)
        {
            StackPanel quickInfoPanel = new StackPanel();

            TextBlock txtHeader = new TextBlock();
            txtHeader.Uid = "1001";
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = Translator.GetInstance().GetString("PanelAirliner", txtHeader.Uid);

            quickInfoPanel.Children.Add(txtHeader);

            if (airliner.Image != null)
            {
                Image imgAirlinerMap = new Image();
                imgAirlinerMap.Width = GraphicsHelpers.GetContentWidth()-100;
                imgAirlinerMap.Source = new BitmapImage(new Uri(airliner.Image, UriKind.RelativeOrAbsolute));
                RenderOptions.SetBitmapScalingMode(imgAirlinerMap, BitmapScalingMode.HighQuality);

                quickInfoPanel.Children.Add(imgAirlinerMap);
            }

            ListBox lbQuickInfo = new ListBox();
            lbQuickInfo.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbQuickInfo.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");

            quickInfoPanel.Children.Add(lbQuickInfo);

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1002"), UICreator.CreateTextBlock(airliner.Name)));

            ContentControl ccManufactorer = new ContentControl();
            ccManufactorer.SetResourceReference(ContentControl.ContentTemplateProperty, "ManufactorerCountryItem");
            ccManufactorer.Content = airliner.Manufacturer;

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1003"), ccManufactorer));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1004"), UICreator.CreateTextBlock(new TextUnderscoreConverter().Convert(airliner.Body, null, null, null).ToString())));

            string range = string.Format("{0:0.##} {1}", new NumberToUnitConverter().Convert(airliner.Range), new StringToLanguageConverter().Convert("km."));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1005"), UICreator.CreateTextBlock(string.Format("{1} ({0})", new TextUnderscoreConverter().Convert(airliner.RangeType), range))));

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1006"), UICreator.CreateTextBlock(new TextUnderscoreConverter().Convert(airliner.Engine, null, null, null).ToString())));

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1007"), UICreator.CreateTextBlock(new NumberMeterToUnitConverter().Convert(airliner.Wingspan).ToString())));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1008"), UICreator.CreateTextBlock(new NumberMeterToUnitConverter().Convert(airliner.Length).ToString())));
            if (airliner.TypeAirliner == AirlinerType.TypeOfAirliner.Passenger)
            {
                lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1009"), UICreator.CreateTextBlock(((AirlinerPassengerType)airliner).MaxSeatingCapacity.ToString())));
                lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1010"), UICreator.CreateTextBlock(((AirlinerPassengerType)airliner).MaxAirlinerClasses.ToString())));
            }
            if (airliner.TypeAirliner == AirlinerType.TypeOfAirliner.Cargo)
            {

                lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner","1017"),UICreator.CreateTextBlock(new CargoSizeConverter().Convert(airliner).ToString())));
            }

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1015"), UICreator.CreateTextBlock(new NumberMeterToUnitConverter().Convert(airliner.MinRunwaylength).ToString())));

            if (airliner.TypeAirliner == AirlinerType.TypeOfAirliner.Passenger)
            {
                string crewRequirements = string.Format("Cockpit: {0} Cabin: {1}", airliner.CockpitCrew, ((AirlinerPassengerType)airliner).CabinCrew);
                lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1011"), UICreator.CreateTextBlock(crewRequirements)));
            }
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1012"), UICreator.CreateTextBlock(string.Format("{0:0.##} {1}", new NumberToUnitConverter().Convert(airliner.CruisingSpeed), new StringToLanguageConverter().Convert("km/t")))));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1013"), UICreator.CreateTextBlock(string.Format("{0:0.###} {1}", new FuelConsumptionToUnitConverter().Convert(airliner.FuelConsumption), new StringToLanguageConverter().Convert("l/seat/km")))));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageFleetAirliner", "1016"), UICreator.CreateTextBlock(string.Format("{0:0.#} {1}", new FuelUnitGtLConverter().Convert(airliner.FuelCapacity), new StringToLanguageConverter().Convert("gallons")))));

            string produced = string.Format("{0}-{1}", airliner.Produced.From > GameObject.GetInstance().GameTime ? "?" : airliner.Produced.From.ToShortDateString(), airliner.Produced.To > GameObject.GetInstance().GameTime ? "?" : airliner.Produced.To.ToShortDateString());

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelAirliner", "1014"), UICreator.CreateTextBlock(produced)));

            return quickInfoPanel;
        }
예제 #24
0
 //adds a prefered aircraft type to the airline
 public void addPreferedAircraft(AirlinerType type)
 {
     this.PreferedAircrafts.Add(type);
 }
        public PopUpAirlinerSeatsConfiguration(AirlinerType type, List<AirlinerClass> classes)
        {
            this.FreeClassTypes = new ObservableCollection<AirlinerClass.ClassType>();
            this.Classes = new ObservableCollection<AirlinerClassMVVM>();
            this.Type = type;

            AirlinerClass economyClass = classes.Find(c => c.Type == AirlinerClass.ClassType.Economy_Class);

            foreach (AirlinerClass aClass in classes)
            {

                int maxseats = aClass.Type == AirlinerClass.ClassType.Economy_Class ? aClass.SeatingCapacity : economyClass.RegularSeatingCapacity - 1;
                AirlinerClassMVVM nClass = new AirlinerClassMVVM(aClass.Type, aClass.SeatingCapacity,maxseats, aClass.Type != AirlinerClass.ClassType.Economy_Class);
                this.Classes.Add(nClass);

                foreach (AirlinerFacility facility in aClass.getFacilities())
                    nClass.Facilities.Where(f=>f.Type == facility.Type).First().SelectedFacility = facility;

            }

            this.CanAddNewClass = this.Classes.Count < ((AirlinerPassengerType)this.Type).MaxAirlinerClasses;

            if (this.Classes.Count < 3)
            {
                this.FreeClassTypes.Clear();
                this.FreeClassTypes.Add(AirlinerClass.ClassType.Business_Class);
                this.FreeClassTypes.Add(AirlinerClass.ClassType.First_Class);

            }

            InitializeComponent();
        }
예제 #26
0
 public static List<Airport> GetHomebases(Airline airline, AirlinerType type)
 {
     return GetHomebases(airline, type.MinRunwaylength);
 }
        public static object ShowPopUp(AirlinerType airliner, List<AirlinerClass> classes)
        {
            PopUpWindow window = new PopUpAirlinerConfiguration(airliner,classes);
            window.ShowDialog();

            return window.Selected;
        }
예제 #28
0
 //adds an airliner type which fits this engine
 public void addAirlinerType(AirlinerType type)
 {
     this.Types.Add(type);
 }
예제 #29
0
 public AirlinerQuantityMVVM(AirlinerType type, int quantity)
 {
     this.Quantity = quantity;
     this.Type = type;
 }
예제 #30
0
 //adds an airliner type with a quantity to the scenario
 public void addFleet(AirlinerType type, int quantity)
 {
     this.Fleet.Add(type, quantity);
 }
예제 #31
0
 //returns the list of engine types for an airliner type
 public static List<EngineType> GetEngineTypes(AirlinerType type)
 {
     return types.FindAll(t => t.Types.Contains(type));
 }
예제 #32
0
 //shows the pop up for an airliner
 public static void ShowPopUp(AirlinerType type)
 {
     PopUpAirlinerImage window = new PopUpAirlinerImage(type);
     window.ShowDialog();
 }
 //adds an airliner type to the list
 public static void AddType(AirlinerType type)
 {
     types.Add(type);
 }
예제 #34
0
 //removes an airliner type
 public static void RemoveType(AirlinerType type)
 {
     types.Remove(type);
 }
예제 #35
0
 //returns the list of engine types for an airliner type
 public static List <EngineType> GetEngineTypes(AirlinerType type)
 {
     return(types.FindAll(t => t.Types.Contains(type)));
 }