public PageManufacturer(Manufacturer manufacturer)
        {
            this.NumberOfAirliners = new List <int>();

            for (int i = 1; i <= 50; i++)
            {
                this.NumberOfAirliners.Add(i);
            }

            this.Manufacturer = manufacturer;

            this.Orders = new AirlinerOrdersMVVM();

            this.Airliners = new ObservableCollection <AirlinerType>();
            AirlinerTypes.GetTypes(a => a.Manufacturer == manufacturer && a.Produced.From <= GameObject.GetInstance().GameTime&& a.Produced.To >= GameObject.GetInstance().GameTime).ForEach(t => this.Airliners.Add(t));
            this.DataContext = this.Airliners;

            this.Contract = new ManufacturerContractMVVM(this.Manufacturer, GameObject.GetInstance().HumanAirline.Contract != null ? GameObject.GetInstance().HumanAirline.Contract.Manufacturer : null);

            InitializeComponent();

            lvAirliners.ItemsSource = this.Airliners;

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvAirliners.ItemsSource);

            view.GroupDescriptions.Clear();

            PropertyGroupDescription groupDescription = new PropertyGroupDescription("AirlinerFamily");

            view.GroupDescriptions.Add(groupDescription);
        }
Exemplo n.º 2
0
        /*!creates an airliner from a specific year
         */
        public static Airliner CreateAirlinerFromYear(int year)
        {
            Guid id = Guid.NewGuid();

            List <AirlinerType> types = AirlinerTypes.GetTypes(t => t.Produced.From.Year <year && t.Produced.To.Year> year);

            int          typeNumber = rnd.Next(types.Count);
            AirlinerType type       = types[typeNumber];

            int     countryNumber = rnd.Next(Countries.GetCountries().Count() - 1);
            Country country       = Countries.GetCountries()[countryNumber];

            int builtYear = year;

            Airliner airliner = new Airliner(id.ToString(), type, country.TailNumbers.getNextTailNumber(), new DateTime(builtYear, 1, 1));

            int age = MathHelpers.CalculateAge(airliner.BuiltDate, GameObject.GetInstance().GameTime);

            long kmPerYear = rnd.Next(1000, 100000);
            long km        = kmPerYear * age;

            airliner.Flown = km;

            CreateAirlinerClasses(airliner);

            return(airliner);
        }
Exemplo n.º 3
0
        /*! create a random airliner with a minimum range.
         */
        private static Airliner CreateAirliner(double minRange)
        {
            Guid id = Guid.NewGuid();

            List <AirlinerType> types = AirlinerTypes.GetTypes(delegate(AirlinerType t) { return(t.Range >= minRange && t.Produced.From.Year < GameObject.GetInstance().GameTime.Year&& t.Produced.To > GameObject.GetInstance().GameTime.AddYears(-30)); });

            int          typeNumber = rnd.Next(types.Count);
            AirlinerType type       = types[typeNumber];

            int     countryNumber = rnd.Next(Countries.GetCountries().Count() - 1);
            Country country       = Countries.GetCountries()[countryNumber];

            int builtYear = rnd.Next(Math.Max(type.Produced.From.Year, GameObject.GetInstance().GameTime.Year - 30), Math.Min(GameObject.GetInstance().GameTime.Year - 1, type.Produced.To.Year));

            Airliner airliner = new Airliner(id.ToString(), type, country.TailNumbers.getNextTailNumber(), new DateTime(builtYear, 1, 1));

            if (airliner.TailNumber.Length < 2)
            {
                typeNumber = 0;
            }

            int age = MathHelpers.CalculateAge(airliner.BuiltDate, GameObject.GetInstance().GameTime);

            long kmPerYear = rnd.Next(100000, 1000000);
            long km        = kmPerYear * age;

            airliner.Flown = km;

            CreateAirlinerClasses(airliner);

            return(airliner);
        }
Exemplo n.º 4
0
        public PageAirliners()
        {
            this.NewestAircrafts   = AirlinerTypes.GetTypes(a => a.Produced.From <= GameObject.GetInstance().GameTime).OrderByDescending(a => a.Produced.From).Take(5).ToList();
            this.MostUsedAircrafts = new List <AirlineFleetSizeMVVM>();

            var query = GameObject.GetInstance().HumanAirline.Fleet.GroupBy(a => a.Airliner.Type)
                        .Select(group =>
                                new
            {
                Type  = group.Key,
                Fleet = group
            })
                        .OrderByDescending(g => g.Fleet.Count());

            var aircrafts = query.Take(Math.Min(query.Count(), 5));

            foreach (var group in aircrafts)
            {
                this.MostUsedAircrafts.Add(new AirlineFleetSizeMVVM(group.Type, group.Fleet.Count()));
            }

            this.Loaded += PageAirliners_Loaded;

            InitializeComponent();
        }
Exemplo n.º 5
0
        public PageNewAirliners()
        {
            this.AllTypes          = new List <AirlinerTypeMVVM>();
            this.SelectedAirliners = new ObservableCollection <AirlinerTypeMVVM>();

            this.RangeRanges = new List <FilterValue>()
            {
                new FilterValue("<1500", 0, 1499), new FilterValue("1500-2999", 1500, 2999), new FilterValue("3000-5999", 3000, 5999), new FilterValue("6000+", 6000, int.MaxValue)
            };
            this.SpeedRanges = new List <FilterValue>()
            {
                new FilterValue("<400", 0, 399), new FilterValue("400-599", 400, 599), new FilterValue("600+", 600, int.MaxValue)
            };
            this.RunwayRanges = new List <FilterValue>()
            {
                new FilterValue("<5000", 0, 4999), new FilterValue("5000-7999", 5000, 7999), new FilterValue("8000+", 8000, int.MaxValue)
            };
            this.CapacityRanges = new List <FilterValue>()
            {
                new FilterValue("<100", 0, 99), new FilterValue("100-199", 100, 199), new FilterValue("200-299", 200, 299), new FilterValue("300-399", 300, 399), new FilterValue("400-499", 400, 499), new FilterValue("500+", 500, int.MaxValue)
            };

            this.AllTypes = new List <AirlinerTypeMVVM>();
            AirlinerTypes.GetTypes(t => t.Produced.From <= GameObject.GetInstance().GameTime&& t.Produced.To > GameObject.GetInstance().GameTime).ForEach(t => this.AllTypes.Add(new AirlinerTypeMVVM(t)));

            InitializeComponent();
        }
Exemplo n.º 6
0
        //checks an airport for extending of runway
        public static void CheckForExtendRunway(Airport airport)
        {
            int minYearsBetweenExpansions = 5;

            long maxRunwayLenght             = (from r in airport.Runways select r.Length).Max();
            long longestRequiredRunwayLenght = AirlinerTypes.GetTypes(a => a.Produced.From <= GameObject.GetInstance().GameTime&& a.Produced.To >= GameObject.GetInstance().GameTime).Max(a => a.MinRunwaylength);

            var airportRoutes  = AirportHelpers.GetAirportRoutes(airport);
            var routeAirliners = airportRoutes.SelectMany(r => r.getAirliners());

            long longestRunwayInUse = routeAirliners.Count() > 0 ? routeAirliners.Max(a => a.Airliner.Type.MinRunwaylength) : 0;

            if (maxRunwayLenght < longestRequiredRunwayLenght / 2 && maxRunwayLenght < longestRunwayInUse * 3 / 4 && GameObject.GetInstance().GameTime.AddYears(-minYearsBetweenExpansions) > airport.LastExpansionDate)
            {
                List <string> runwayNames = (from r in Airports.GetAllAirports().SelectMany(a => a.Runways) select r.Name).Distinct().ToList();

                foreach (Runway r in airport.Runways)
                {
                    runwayNames.Remove(r.Name);
                }

                Runway.SurfaceType surface = airport.Runways[0].Surface;
                long lenght = Math.Min(longestRequiredRunwayLenght * 3 / 4, longestRunwayInUse * 2);

                Runway runway = new Runway(runwayNames[rnd.Next(runwayNames.Count)], lenght, surface, GameObject.GetInstance().GameTime.AddDays(90), false);
                airport.Runways.Add(runway);

                airport.LastExpansionDate = GameObject.GetInstance().GameTime;
            }
        }
Exemplo n.º 7
0
        public PageManufacturers()
        {
            this.AllManufacturers = (from a in AirlinerTypes.GetAllTypes() where a.Produced.From <= GameObject.GetInstance().GameTime&& a.Produced.To >= GameObject.GetInstance().GameTime orderby a.Manufacturer.Name select a.Manufacturer).Distinct().ToList();
            this.Loaded          += PageManufacturers_Loaded;

            InitializeComponent();
        }
        private void btnConvertToCargo_Click(object sender, RoutedEventArgs e)
        {
            double convertPrice = GeneralHelpers.GetInflationPrice(1000 * ((AirlinerPassengerType)this.Airliner.Airliner.Type).MaxSeatingCapacity);

            if (this.Airliner.Airliner.getPrice() > GameObject.GetInstance().HumanAirline.Money)
            {
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2109"), Translator.GetInstance().GetString("MessageBox", "2109", "message"), WPFMessageBoxButtons.Ok);
            }
            else
            {
                WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2123"), string.Format(Translator.GetInstance().GetString("MessageBox", "2123", "message"), this.Airliner.Name, new ValueCurrencyConverter().Convert(convertPrice)), WPFMessageBoxButtons.YesNo);
                if (result == WPFMessageBoxResult.Yes)
                {
                    AirlinerPassengerType currentType = this.Airliner.Airliner.Type as AirlinerPassengerType;

                    string airlinerName = string.Format("{0} Freighter", currentType.Name);

                    double cargoSize = AirlinerHelpers.ConvertPassengersToCargoSize(currentType);

                    AirlinerType newCargoType = new AirlinerCargoType(currentType.Manufacturer, airlinerName, currentType.AirlinerFamily, currentType.CockpitCrew, cargoSize, currentType.CruisingSpeed, currentType.Range, currentType.Wingspan, currentType.Length, currentType.FuelConsumption, currentType.Price, currentType.MinRunwaylength, currentType.FuelCapacity, currentType.Body, currentType.RangeType, currentType.Engine, currentType.Produced, currentType.ProductionRate, false);
                    newCargoType.BaseType = currentType;
                    AirlinerTypes.AddType(newCargoType);

                    this.Airliner.Airliner.Type = newCargoType;

                    AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Airline_Expenses, -convertPrice);

                    PageNavigator.NavigateTo(new PageFleetAirliner(this.Airliner));
                }
            }
        }
Exemplo n.º 9
0
        /*! create some game airliners.
         */
        public static void CreateStartUpAirliners()
        {
            int number = AirlinerTypes.GetTypes(delegate(AirlinerType t) { return(t.Produced.From <= GameObject.GetInstance().GameTime&& t.Produced.To >= GameObject.GetInstance().GameTime.AddYears(-30)); }).Count * 25;

            for (int i = 0; i < number; i++)
            {
                Airliners.AddAirliner(CreateAirliner(0));
            }
        }
Exemplo n.º 10
0
        /*! create some game airliners.
         */
        public static void CreateStartUpAirliners()
        {
            int number = AirlinerTypes.GetTypes(delegate(AirlinerType t) { return(t.Produced.From <= GameObject.GetInstance().GameTime&& t.Produced.To.AddYears(-10) >= GameObject.GetInstance().GameTime.AddYears(-30)); }).Count *rnd.Next(1, 3);

            int airlines = Airlines.GetNumberOfAirlines();

            number = (airlines * number) / 5;
            for (int i = 0; i < number; i++)
            {
                Airliners.AddAirliner(CreateAirliner(0));
            }
        }
Exemplo n.º 11
0
        public PageShowFlightSchool(FlightSchool fs)
        {
            this.FlightSchool     = new FlightSchoolMVVM(fs);
            this.Instructors      = new ObservableCollection <Instructor>();
            this.AirlinerFamilies = AirlinerTypes.GetTypes(t => t.Produced.From.Year <= GameObject.GetInstance().GameTime.Year&& t.Produced.To > GameObject.GetInstance().GameTime.AddYears(-30)).Select(t => t.AirlinerFamily).Distinct().OrderBy(a => a).ToList();

            this.DataContext = this.FlightSchool;

            setHireStudentsStatus();

            InitializeComponent();
        }
Exemplo n.º 12
0
        private void btnTrainPilot_Click(object sender, RoutedEventArgs e)
        {
            double substituteDayPrice = 500;

            PilotMVVM pilot = (PilotMVVM)((Button)sender).Tag;

            ComboBox cbAirlinerFamily = new ComboBox();

            cbAirlinerFamily.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAirlinerFamily.ItemTemplate        = this.Resources["TrainingFacility"] as DataTemplate;
            cbAirlinerFamily.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbAirlinerFamily.Width = 350;

            var airlinerFamilies = AirlinerTypes.GetTypes(t => t.Produced.From.Year <= GameObject.GetInstance().GameTime.Year&& t.Produced.To > GameObject.GetInstance().GameTime.AddYears(-30)).Select(t => t.AirlinerFamily).Where(t => !pilot.Pilot.Aircrafts.Contains(t)).Distinct().OrderBy(a => a);

            foreach (string family in airlinerFamilies)
            {
                double price = AirlineHelpers.GetTrainingPrice(pilot.Pilot, family);;
                cbAirlinerFamily.Items.Add(new PilotTrainingMVVM(family, AirlineHelpers.GetTrainingDays(pilot.Pilot, family), price));
            }

            cbAirlinerFamily.SelectedIndex = 0;

            if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PageAirlineEmployees", "1014"), cbAirlinerFamily) == PopUpSingleElement.ButtonSelected.OK && cbAirlinerFamily.SelectedItem != null)
            {
                PilotTrainingMVVM pilotTraining = (PilotTrainingMVVM)cbAirlinerFamily.SelectedItem;

                if (pilot.Pilot.Airliner == null)
                {
                    AirlineHelpers.SendForTraining(GameObject.GetInstance().HumanAirline, pilot.Pilot, pilotTraining.Family, pilotTraining.TrainingDays, pilotTraining.Price);

                    pilot.OnTraining = true;
                }
                else
                {
                    double substitutePrice = GeneralHelpers.GetInflationPrice(pilotTraining.TrainingDays * substituteDayPrice);

                    WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2129"), string.Format(Translator.GetInstance().GetString("MessageBox", "2129", "message"), new ValueCurrencyConverter().Convert(substitutePrice), pilotTraining.TrainingDays), WPFMessageBoxButtons.YesNo);

                    if (result == WPFMessageBoxResult.Yes)
                    {
                        AirlineHelpers.AddAirlineInvoice(this.Airline.Airline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Airline_Expenses, -substitutePrice);
                        AirlineHelpers.SendForTraining(GameObject.GetInstance().HumanAirline, pilot.Pilot, pilotTraining.Family, pilotTraining.TrainingDays, pilotTraining.Price);

                        pilot.OnTraining = true;
                    }
                }
            }
        }
Exemplo n.º 13
0
        public PanelNewRoute(PageRoutes parent)
        {
            this.Classes    = new Dictionary <AirlinerClass.ClassType, RouteAirlinerClass>();
            this.CargoPrice = 10;

            var query = from a in AirlinerTypes.GetTypes(delegate(AirlinerType t) { return(t.Produced.From < GameObject.GetInstance().GameTime); })
                        select a.Range;

            this.MaxDistance = query.Max();

            this.ParentPage = parent;

            this.Margin = new Thickness(0, 0, 50, 0);

            TextBlock txtHeader = new TextBlock();

            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text       = Translator.GetInstance().GetString("PanelNewRoute", "201");
            this.Children.Add(txtHeader);

            WrapPanel panelRouteType = new WrapPanel();

            rbPassenger           = new RadioButton();
            rbPassenger.GroupName = "RouteType";
            rbPassenger.Content   = Translator.GetInstance().GetString("PanelNewRoute", "1005");
            rbPassenger.Checked  += rbRouteType_Checked;
            rbPassenger.Tag       = Route.RouteType.Passenger;
            panelRouteType.Children.Add(rbPassenger);

            rbCargo           = new RadioButton();
            rbCargo.Margin    = new Thickness(10, 0, 0, 0);
            rbCargo.GroupName = "RouteType";
            rbCargo.Content   = Translator.GetInstance().GetString("PanelNewRoute", "1006");
            rbCargo.Tag       = Route.RouteType.Cargo;
            //rbCargo.IsEnabled = false;
            rbCargo.Checked += rbRouteType_Checked;
            panelRouteType.Children.Add(rbCargo);

            this.Children.Add(panelRouteType);


            panelRouteInfo = new StackPanel();
            this.Children.Add(panelRouteInfo);
            //rbPassenger.IsChecked = true;
        }
Exemplo n.º 14
0
        //creates a number of airliner families a pilot can fly
        public static List <string> GetPilotAircrafts(Pilot pilot)
        {
            int year = GameObject.GetInstance().GameTime.Year;

            var airlinerFamilies = AirlinerTypes.GetTypes(t => t.Produced.From.Year <= GameObject.GetInstance().GameTime.Year&& t.Produced.To > GameObject.GetInstance().GameTime.AddYears(-30)).Select(a => a.AirlinerFamily).Distinct();

            Random        rnd      = new Random();
            List <string> families = new List <string>();

            int numberOfAircrafts = PilotRatings.GetRatings().IndexOf(pilot.Rating) + 1;

            for (int i = 0; i < numberOfAircrafts; i++)
            {
                var    freeFamilies = airlinerFamilies.Where(a => !families.Contains(a)).ToList();
                string family       = freeFamilies[rnd.Next(freeFamilies.Count)];

                families.Add(family);
            }

            return(families);
        }
Exemplo n.º 15
0
 //shows the list of manufacturers
 private void showManufacturers()
 {
     lbManufacturers.Items.Clear();
     (from a in AirlinerTypes.GetAllTypes() where a.Produced.From <= GameObject.GetInstance().GameTime&& a.Produced.To >= GameObject.GetInstance().GameTime orderby a.Manufacturer.Name select a.Manufacturer).Distinct().ToList().ForEach(m => lbManufacturers.Items.Add(m));
 }
        public PageOrderAirliners(PageAirliners parent, Manufacturer manufacturer)
        {
            this.ParentPage   = parent;
            this.Manufacturer = manufacturer;

            this.customConfiguration = false;
            this.orders  = new List <AirlinerOrder>();
            this.Classes = new List <AirlinerClass>();

            InitializeComponent();

            ScrollViewer scroller = new ScrollViewer();

            scroller.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroller.MaxHeight = GraphicsHelpers.GetContentHeight();

            StackPanel mainPanel = new StackPanel();

            mainPanel.Margin = new Thickness(0, 0, 5, 0);
            scroller.Content = mainPanel;

            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("PageOrderAirliners", txtHeader.Uid);

            mainPanel.Children.Add(txtHeader);

            ListBox lbManufacturers = new ListBox();

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

            cbAirport = new ComboBox();
            cbAirport.SetResourceReference(ComboBox.ItemTemplateProperty, "AirportCountryItem");
            cbAirport.Background = Brushes.Transparent;
            cbAirport.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAirport.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

            List <Airport> airports = GameObject.GetInstance().HumanAirline.Airports.FindAll(a => a.getCurrentAirportFacility(GameObject.GetInstance().HumanAirline, AirportFacility.FacilityType.Service).TypeLevel > 0);

            airports = airports.OrderBy(a => a.Profile.Name).ToList();

            foreach (Airport airport in airports)
            {
                cbAirport.Items.Add(airport);
            }

            cbAirport.SelectedIndex = 0;

            lbManufacturers.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageOrderAirliners", "1007"), cbAirport));

            DateTime firstDate = GameObject.GetInstance().GameTime.AddMonths(3);

            dpDate = new DatePicker();
            dpDate.SetResourceReference(DatePicker.CalendarStyleProperty, "CalendarPickerStyle");
            dpDate.DisplayDateStart = new DateTime(firstDate.Year, firstDate.Month, 1);
            dpDate.DisplayDateEnd   = GameObject.GetInstance().GameTime.AddYears(5);
            dpDate.DisplayDate      = firstDate;
            dpDate.SelectedDate     = firstDate;

            for (int i = 1; i < firstDate.Day; i++)
            {
                dpDate.BlackoutDates.Add(new CalendarDateRange(new DateTime(firstDate.Year, firstDate.Month, i)));
            }


            lbManufacturers.Items.Add(new QuickInfoValue("Delivery time", dpDate));

            ContentControl ccManufacturer = new ContentControl();

            ccManufacturer.SetResourceReference(ContentControl.ContentTemplateProperty, "ManufactorerLogoItem");
            ccManufacturer.Content = this.Manufacturer;

            lbManufacturers.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageOrderAirliners", "1003"), ccManufacturer));
            lbManufacturers.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageOrderAirliners", "1004"), createOrderPanel()));

            mainPanel.Children.Add(lbManufacturers);

            TextBlock txtOrders = new TextBlock();

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

            txtOrders.Margin = new Thickness(0, 5, 0, 0);

            mainPanel.Children.Add(txtOrders);

            lbOrders = new ListBox();
            lbOrders.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbOrders.ItemTemplate = this.Resources["AirlinerOrderItem"] as DataTemplate;
            //lbOrders.MaxHeight = GraphicsHelpers.GetContentHeight() / 4;

            mainPanel.Children.Add(lbOrders);

            ListBox lbPrice = new ListBox();

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

            txtDiscount   = new TextBlock();
            txtTotalPrice = new TextBlock();

            lbPrice.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageOrderAirliners", "1005"), txtDiscount));
            lbPrice.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageOrderAirliners", "1006"), txtTotalPrice));

            cbDownPayment = new CheckBox();
            lbPrice.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageOrderAirliners", "1008"), cbDownPayment));

            mainPanel.Children.Add(lbPrice);

            WrapPanel panelButtons = new WrapPanel();

            panelButtons.Margin = new Thickness(0, 5, 0, 0);
            mainPanel.Children.Add(panelButtons);

            btnOrder     = new Button();
            btnOrder.Uid = "200";
            btnOrder.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnOrder.Height  = Double.NaN;
            btnOrder.Width   = Double.NaN;
            btnOrder.Content = Translator.GetInstance().GetString("PageOrderAirliners", btnOrder.Uid);
            btnOrder.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnOrder.Click    += new RoutedEventHandler(btnOrder_Click);
            btnOrder.IsEnabled = false;

            panelButtons.Children.Add(btnOrder);

            Button btnContract = new Button();

            btnContract.Uid = "1009";
            btnContract.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnContract.Height  = Double.NaN;
            btnContract.Width   = Double.NaN;
            btnContract.Content = Translator.GetInstance().GetString("PageOrderAirliners", btnContract.Uid);
            btnContract.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnContract.Margin = new Thickness(5, 0, 0, 0);
            btnContract.Click += new RoutedEventHandler(btnContract_Click);

            panelButtons.Children.Add(btnContract);

            frameAirlinerInfo        = new Frame();
            frameAirlinerInfo.Margin = new Thickness(0, 10, 0, 0);
            mainPanel.Children.Add(frameAirlinerInfo);


            this.Content = scroller;

            showOrders();

            (from t in AirlinerTypes.GetAllTypes() where t.Produced.From <= GameObject.GetInstance().GameTime&& t.Produced.To >= GameObject.GetInstance().GameTime&& t.Manufacturer == this.Manufacturer orderby t.Name select t).ToList().ForEach(m => cbTypes.Items.Add(m));

            cbTypes.SelectedIndex = 0;
        }