public AirlinerPassengerType(Manufacturer manufacturer, string name,string family, int seating, int cockpitcrew, int cabincrew, double speed, long range, double wingspan, double length, double consumption, long price, int maxAirlinerClasses, long minRunwaylength, long fuelcapacity, BodyType body, TypeRange rangeType, EngineType engine, Period<DateTime> produced, int prodRate, Boolean standardType = true)
     : base(manufacturer,TypeOfAirliner.Passenger,name,family,cockpitcrew,speed,range,wingspan,length,consumption,price,minRunwaylength,fuelcapacity,body,rangeType,engine,produced, prodRate,standardType)
 {
     this.MaxSeatingCapacity = seating;
     this.CabinCrew = cabincrew;
     this.MaxAirlinerClasses = maxAirlinerClasses;
 }
        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);
        }
 public ManufacturerContract(Manufacturer manufacturer, DateTime date, int length, double discount)
 {
     this.Manufacturer = manufacturer;
     this.Airliners = length;
     this.SigningDate = date;
     this.Length = length;
     this.Discount = discount;
     this.ExpireDate = date.AddYears(this.Length);
     this.PurchasedAirliners = 0;
 }
 public AirlinerType(Manufacturer manufacturer,TypeOfAirliner typeOfAirliner, string name,string family, int cockpitCrew, double speed, long range, double wingspan, double length, double consumption, long price,long minRunwaylength, long fuelcapacity, BodyType body, TypeRange rangeType, EngineType engine, Period<DateTime> produced,int prodRate, Boolean standardType)
 {
     this.TypeAirliner = typeOfAirliner;
     this.AirlinerFamily = family;
     this.Manufacturer = manufacturer;
     this.Name = name;
     this.CruisingSpeed = speed;
     this.Range = range;
     this.Wingspan = wingspan;
     this.Length = length;
     this.CockpitCrew = cockpitCrew;
     this.Price = price;
     this.FuelConsumption = consumption;
     this.Produced = produced;
     this.Engine = engine;
     this.Body = body;
     this.RangeType = rangeType;
     this.MinRunwaylength = minRunwaylength;
     this.FuelCapacity = fuelcapacity;
     this.IsStandardType = standardType;
     this.ProductionRate = prodRate;
 }
Beispiel #5
0
 //adds a manufacturer to the collection
 public static void AddManufacturer(Manufacturer manufacturer)
 {
     manufacturers.Add(manufacturer);
 }
 public ManufacturerContractMVVM(Manufacturer manufacturer, Manufacturer contracted)
 {
     this.Contracted = contracted;
     this.Manufacturer = manufacturer;
 }
 public AirlinerCargoType(Manufacturer manufacturer, string name,string family, int cockpitcrew, double cargoSize,  double speed, long range, double wingspan, double length, double consumption, long price, long minRunwaylength, long fuelcapacity, BodyType body, TypeRange rangeType, EngineType engine, Period<DateTime> produced, int prodRate, Boolean standardType = true)
     : base(manufacturer,TypeOfAirliner.Cargo,name,family,cockpitcrew,speed,range,wingspan,length,consumption,price,minRunwaylength,fuelcapacity,body,rangeType,engine,produced, prodRate,standardType)
 {
     this.CargoSize = cargoSize;
 }
Beispiel #8
0
 public AirlinerCombiType(Manufacturer manufacturer, string name, string family, int seating, int cockpitcrew, int cabincrew, double speed, long range, double wingspan, double length, double consumption, long price, int maxAirlinerClasses, long minRunwaylength, long fuelcapacity, BodyType body, TypeRange rangeType, EngineType engine, Period<DateTime> produced, int prodRate, double cargo, Boolean isConvertable, Boolean standardType = true)
     : base(manufacturer, name, family, seating, cockpitcrew, cabincrew, speed, range, wingspan, length, consumption, price, maxAirlinerClasses, minRunwaylength, fuelcapacity, body, rangeType, engine, produced, prodRate, isConvertable, standardType)
 {
     this.CargoSize = cargo;
     this.TypeAirliner = TypeOfAirliner.Mixed;
 }
        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;
        }