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(); }
//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; }