Пример #1
1
        public PageHeader()
        {
            Brush brush = new SolidColorBrush(Colors.DarkGray);
            brush.Opacity = 0.60;

            this.Background = brush;

            Border frameBorder = new Border();
            frameBorder.BorderBrush = Brushes.Gray;
            frameBorder.BorderThickness = new Thickness(2);

            DockPanel panelMain = new DockPanel();
            panelMain.Margin = new Thickness(5, 5, 5, 5);
            panelMain.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            txtText = new TextBlock();
            txtText.FontSize = 32;
            txtText.Margin = new Thickness(5, 0, 0, 0);
            txtText.SetResourceReference(TextBlock.ForegroundProperty, "HeaderTextColor");
            txtText.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            panelMain.Children.Add(txtText);

            frameBorder.Child = panelMain;

            this.Content = frameBorder;
        }
Пример #2
0
        public static void Add(Grid grid, string label, Binding value, int row, string labelStyle, string inputStyle, int startColumn)
        {
            int column = startColumn;
            if (label != "")
            {
                TextBlock labelElement = new TextBlock();
                labelElement.Style = App.Instance.Resources[labelStyle] as Style;
                labelElement.SetResourceReference(TextBlock.TextProperty, label);
                labelElement.VerticalAlignment = VerticalAlignment.Center;
                labelElement.Margin = new Thickness(column > 0 ? 5 : 0, 0, 0, 5);

                grid.Children.Add(labelElement);
                Grid.SetColumn(labelElement, column);
                Grid.SetRow(labelElement, row);
                column += 1;
            }

            System.Windows.Controls.TextBox inputElement = new System.Windows.Controls.TextBox();
            inputElement.HorizontalAlignment = HorizontalAlignment.Stretch;
            inputElement.Margin = new Thickness(column > 0?5:0, 0, 0, 5);
            if (inputStyle != "")
            {
                Style s = App.Instance.Resources[inputStyle] as Style;;
                if (s.TargetType == typeof(System.Windows.Controls.TextBox))
                    inputElement.Style = s;
            }
            inputElement.SetBinding(System.Windows.Controls.TextBox.TextProperty, value);

            grid.Children.Add(inputElement);
            Grid.SetColumn(inputElement, column);
            Grid.SetRow(inputElement, row);
        }
        public PageFleetRoute(FleetAirliner airliner)
        {
            InitializeComponent();

            this.Airliner = airliner;

            InitializeComponent();

            StackPanel panelRoute = new StackPanel();
            panelRoute.Margin = new Thickness(0, 10, 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("PageFleetRoute","1000");

            if (this.Airliner.HasRoute)
            {
               panelRoute.Children.Add(createRoutesInfo());
               panelRoute.Children.Add(createFlightInfo());

                if (this.Airliner.Airliner.Airline == GameObject.GetInstance().HumanAirline) panelRoute.Children.Add(createFlightButtons());
            }
            else panelRoute.Children.Add(txtHeader);

            this.Content = panelRoute;
        }
        public PageAirportsStatistics()
        {
            InitializeComponent();

            StackPanel panelStatistics = new StackPanel();
            panelStatistics.Margin = new Thickness(0, 10, 50, 0);

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

            panelStatistics.Children.Add(txtHeader);

            lbAirports = new ListBox();
            lbAirports.ItemTemplate = this.Resources["AirportItem"] as DataTemplate;
            lbAirports.Height = 500;
            lbAirports.ItemContainerStyleSelector = new ListBoxItemStyleSelector();

            panelStatistics.Children.Add(lbAirports);

            //GameTimer.GetInstance().OnTimeChanged += new GameTimer.TimeChanged(PageAirportsStatistics_OnTimeChanged);

            //this.Unloaded += new RoutedEventHandler(PageAirportsStatistics_Unloaded);

            this.Content = panelStatistics;

            showAirports();
        }
Пример #5
0
        public PageAirlinePilots(Airline airline)
        {
            this.Airline = airline;

            InitializeComponent();

            StackPanel panelPilots = new StackPanel();
            panelPilots.Margin = new Thickness(0, 10, 50, 0);

            TextBlock txtHeader = new TextBlock();
            txtHeader.Uid = "1001";
            txtHeader.Margin = new Thickness(0, 0, 0, 0);
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = Translator.GetInstance().GetString("PageAirlinePilots", txtHeader.Uid);
            panelPilots.Children.Add(txtHeader);

            ContentControl ccHeader = new ContentControl();
            ccHeader.ContentTemplate = this.Resources["PilotsHeader"] as DataTemplate;
            ccHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            panelPilots.Children.Add(ccHeader);

            lbPilots = new ListBox();
            lbPilots.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbPilots.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            lbPilots.ItemTemplate = this.Resources["PilotItem"] as DataTemplate;
            lbPilots.MaxHeight = GraphicsHelpers.GetContentHeight() / 2;
            panelPilots.Children.Add(lbPilots);

            this.Content = panelPilots;

            showPilots();
        }
        public static bool ShowOptionsWindow( FrameworkElement ChatControl, RatChat.Core.ConfigStorage ChatConfigStorage )
        {
            ChatOptionsWindow cow = new ChatOptionsWindow();
            var data = ChatControl.Tag as Tuple<RatChat.Core.IChatSource, string>;

            var configs = (from a in ConfigValueAttribute.GetAttribute(data.Item1.GetType())
                           orderby a.Caption
                           select a).ToArray();

            for (int j=0; j<configs.Length; ++j ) {
                cow.OptionsGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(30.0) });

                // add text,
                TextBlock text = new TextBlock() { Text = configs[j].Caption };
                text.SetResourceReference(TextBlock.StyleProperty, "ConfigText");

                cow.OptionsGrid.Children.Add(text);
                Grid.SetRow(text, j);

                // add textbox
                UIElement val = null;

                if (configs[j].IsPasswordInput) {
                    val = new PasswordBox() { Tag = data.Item1.ConfigPrefix + configs[j].Name, Margin = new Thickness(2) };
                    ((PasswordBox)val).Password = (string)ChatConfigStorage.GetDefault(data.Item1.ConfigPrefix + configs[j].Name, configs[j].DefaultValue);
                } else {
                    val = new TextBox() { Tag = data.Item1.ConfigPrefix + configs[j].Name, Margin = new Thickness(2) };
                    ((TextBox)val).Text = (string)ChatConfigStorage.GetDefault(data.Item1.ConfigPrefix + configs[j].Name, configs[j].DefaultValue);
                }

                cow.OptionsGrid.Children.Add(val);
                Grid.SetRow(val, j);
                Grid.SetColumn(val, 1);
            }

            bool? ret = cow.ShowDialog();
            if (ret.HasValue && ret.Value) {
                // save
                for (int j = 0; j < cow.OptionsGrid.Children.Count; ++j) {
                    TextBox val = cow.OptionsGrid.Children[j] as TextBox;
                    if (val != null) {
                        string name = val.Tag as string;
                        ChatConfigStorage[name] = val.Text;
                    } else {
                        PasswordBox pb = cow.OptionsGrid.Children[j] as PasswordBox;
                        if (pb != null) {
                            string name = pb.Tag as string;
                            ChatConfigStorage[name] = pb.Password;
                        }
                    }
                }

                return true;
            }

            return false;
        }
        public PageAirportTraffic(Airport airport)
        {
            this.Airport = airport;

            InitializeComponent();

            StackPanel panelTraffic = new StackPanel();
            panelTraffic.Margin = new Thickness(0, 10, 50, 0);

            TextBlock txtPassengerHeader = new TextBlock();
            txtPassengerHeader.Uid = "1001";
            txtPassengerHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtPassengerHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtPassengerHeader.FontWeight = FontWeights.Bold;
            txtPassengerHeader.Text = Translator.GetInstance().GetString("PageAirportTraffic", txtPassengerHeader.Uid);
            panelTraffic.Children.Add(txtPassengerHeader);

            ListBox lbPassengerDestinations = new ListBox();
            lbPassengerDestinations.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbPassengerDestinations.ItemTemplate = this.Resources["DestinationItem"] as DataTemplate;
            lbPassengerDestinations.MaxHeight = (GraphicsHelpers.GetContentHeight() - 100)/2;

            var destinations = from a in Airports.GetAllActiveAirports() orderby this.Airport.getDestinationPassengerStatistics(a) descending select a;

            foreach (Airport a in destinations.Take(20))
                lbPassengerDestinations.Items.Add(new KeyValuePair<Airport,long>(a,this.Airport.getDestinationPassengerStatistics(a)));

            panelTraffic.Children.Add(lbPassengerDestinations);

            TextBlock txtCargoHeader = new TextBlock();
            txtCargoHeader.Margin = new Thickness(0, 10, 0, 0);
            txtCargoHeader.Uid = "1002";
            txtCargoHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtCargoHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtCargoHeader.FontWeight = FontWeights.Bold;
            txtCargoHeader.Text = Translator.GetInstance().GetString("PageAirportTraffic", txtCargoHeader.Uid);
            panelTraffic.Children.Add(txtCargoHeader);

            ListBox lbCargoDestinations = new ListBox();
            lbCargoDestinations.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbCargoDestinations.ItemTemplate = this.Resources["DestinationItem"] as DataTemplate;
            lbCargoDestinations.MaxHeight = (GraphicsHelpers.GetContentHeight() - 100) / 2;

            var cargoDestinations = from a in Airports.GetAllActiveAirports() orderby this.Airport.getDestinationCargoStatistics(a) descending select a;

            foreach (Airport a in destinations.Take(20))
                lbCargoDestinations.Items.Add(new KeyValuePair<Airport, double>(a, this.Airport.getDestinationCargoStatistics(a)));

            panelTraffic.Children.Add(lbCargoDestinations);

            this.Content = panelTraffic;
        }
        public PageAirlineSubsidiaries(Airline airline, StandardPage parent)
        {
            this.PageParent = parent;
            this.Airline = airline;

            InitializeComponent();

            StackPanel panelSubsidiaries = new StackPanel();
            panelSubsidiaries.Margin = new Thickness(0, 10, 50, 0);

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

            panelSubsidiaries.Children.Add(txtSubsidiariesHeader);

            lbSubsidiaryAirline = new ListBox();
            lbSubsidiaryAirline.ItemTemplate = this.Resources["SubsidiaryItem"] as DataTemplate;
            lbSubsidiaryAirline.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbSubsidiaryAirline.MaxHeight = GraphicsHelpers.GetContentHeight() - 100;

            showSubsidiaries();

            panelSubsidiaries.Children.Add(lbSubsidiaryAirline);

            WrapPanel panelButtons = new WrapPanel();
            panelButtons.Visibility = this.Airline.IsHuman && !(this.Airline is SubsidiaryAirline) && this.Airline.Money>100000 ? Visibility.Visible : Visibility.Collapsed;
            panelButtons.Margin = new Thickness(0,5,0,0);

            panelSubsidiaries.Children.Add(panelButtons);

            Button btnCreate = new Button();
            btnCreate.Uid = "200";
            btnCreate.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnCreate.Height = Double.NaN;
            btnCreate.Width = Double.NaN;
            btnCreate.Content = Translator.GetInstance().GetString("PageAirlineSubsidiaries",btnCreate.Uid);
            btnCreate.Click+=new RoutedEventHandler(btnCreate_Click);
            btnCreate.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");

            panelButtons.Children.Add(btnCreate);

            if (this.Airline.IsHuman)
                panelSubsidiaries.Children.Add(createTransferFundsPanel());

            this.Content = panelSubsidiaries;
        }
        public PageAirlineFacilityMaintenance(AirlineFacility facility)
        {
            this.AirlinersToMaintain = new List<FleetAirliner>();
            this.AirlineFacility = facility;
            this.Classes = new List<AirlinerClass>();

            InitializeComponent();

            StackPanel facilityPanel = new StackPanel();
            facilityPanel.Margin = new Thickness(10, 0, 10, 0);

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

            facilityPanel.Children.Add(txtHeader);

            ContentControl ccHeader = new ContentControl();
            ccHeader.ContentTemplate = this.Resources["FleetHeader"] as DataTemplate;
            ccHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            facilityPanel.Children.Add(ccHeader);

            ListBox lbAirliners = new ListBox();
            lbAirliners.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbAirliners.ItemTemplate = this.Resources["AirlinerItem"] as DataTemplate;
            lbAirliners.MaxHeight = GraphicsHelpers.GetContentHeight() / 2;

            foreach (FleetAirliner airliner in GameObject.GetInstance().HumanAirline.DeliveredFleet)
                lbAirliners.Items.Add(airliner);

            facilityPanel.Children.Add(lbAirliners);
            facilityPanel.Children.Add(createClassesPanel());
            facilityPanel.Children.Add(createButtonsPanel());

            StandardContentPanel panelContent = new StandardContentPanel();

            panelContent.setContentPage(facilityPanel, StandardContentPanel.ContentLocation.Left);

            base.setContent(panelContent);

            base.setHeaderContent(this.AirlineFacility.Name);

            showPage(this);
        }
        public SimpleUIUsingResourceDictionary()
        {
            var stack = new StackPanel();
            Content = stack;

            var textBlock = new TextBlock();
            textBlock.SetResourceReference(TextBlock.StyleProperty, SimpleResourceDictionary.TextBlockStyleKey);
            textBlock.SetBinding(TextBlock.TextProperty, new Binding("FirstName"));
            stack.Children.Add(textBlock);

            var local = textBlock.GetValue(TextBlock.StyleProperty);

            textBlock = new TextBlock();
            textBlock.SetBinding(TextBlock.TextProperty, new Binding("LstName")); //purposefully misspelled
            stack.Children.Add(textBlock);
        }
Пример #11
0
        private void insertSettings()
        {
            var landscapeTab = new TabItem();
            var tabHeader = new TextBlock { Text = "Landscape" };
            tabHeader.SetResourceReference(Control.StyleProperty, "TabHeaderTextStyleKey");
            landscapeTab.Header = tabHeader;
            landscapeTab.Content = new LandscapeView
            {
                DataContext = LandscapeViewModel.Instance,
                Margin = KCVApp.ViewModelRoot.Content is StartContentViewModel ? new Thickness(10, 9, 10, 9) : new Thickness(10, 0, 10, 0)
            };

            var settingsTab = (from view in KCVUIHelper.KCVContent.FindVisualChildren<TabControl>()
                               where view.DataContext is SettingsViewModel
                               select view).First();
            settingsTab.Items.Add(landscapeTab);
        }
        public PopUpAirlinerClassConfiguration(AirlinerClass aClass)
        {
            InitializeComponent();

            this.AirlinerClass = aClass;

            this.Title = new TextUnderscoreConverter().Convert(aClass.Type.ToString()).ToString();

            this.Width = 400;

            this.Height = 200;

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

            StackPanel panelClassFacilities = new StackPanel();

            TextBlock txtHeader = new TextBlock();
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = string.Format("{0}", new TextUnderscoreConverter().Convert(aClass.Type, null, null, null));

            panelClassFacilities.Children.Add(txtHeader);

            lbFacilities = new ListBox[Enum.GetValues(typeof(AirlinerFacility.FacilityType)).Length];

            int i = 0;
            foreach (AirlinerFacility.FacilityType type in Enum.GetValues(typeof(AirlinerFacility.FacilityType)))
            {
                AirlinerFacility facility = aClass.GetFacility(type);

                lbFacilities[i] = new ListBox();
                lbFacilities[i].ItemContainerStyleSelector = new ListBoxItemStyleSelector();
                lbFacilities[i].ItemTemplate = this.Resources["FleetFacilityItem"] as DataTemplate;

                panelClassFacilities.Children.Add(lbFacilities[i]);

                i++;

            }
            panelClassFacilities.Children.Add(createButtonsPanel());

            this.Content = panelClassFacilities;

            showFacilities();
        }
Пример #13
0
        public PanelPilot(PagePilots parent, Pilot pilot)
        {
            this.ParentPage = parent;
            this.Pilot = pilot;

            InitializeComponent();

            StackPanel panelPilot = 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("PanelPilot", txtHeader.Uid);

            panelPilot.Children.Add(txtHeader);

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

            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot","1002"), UICreator.CreateTextBlock(this.Pilot.Profile.Name)));
            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1003"), UICreator.CreateTextBlock(this.Pilot.Profile.Birthdate.ToShortDateString())));
            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1004"), UICreator.CreateTownPanel(this.Pilot.Profile.Town)));

            ContentControl lblFlag = new ContentControl();
            lblFlag.SetResourceReference(ContentControl.ContentTemplateProperty, "CountryFlagLongItem");
            lblFlag.Content = new CountryCurrentCountryConverter().Convert(this.Pilot.Profile.Town.Country);

            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1005"), lblFlag));

            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1006"), UICreator.CreateTextBlock(this.Pilot.EducationTime.ToShortDateString())));
            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1007"), UICreator.CreateTextBlock(this.Pilot.Rating.ToString())));
               // lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1008"), UICreator.CreateTextBlock(string.Format("{0:C}", ((int)this.Pilot.Rating) * 1000))));

            double pilotBasePrice = GameObject.GetInstance().HumanAirline.Fees.getValue(FeeTypes.GetType("Pilot Base Salary"));//GeneralHelpers.GetInflationPrice(133.53);<

            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1008"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(((int)this.Pilot.Rating) * pilotBasePrice).ToString())));

            panelPilot.Children.Add(lbPilotInformation);

            panelPilot.Children.Add(createButtonsPanel());

            this.Content = panelPilot;
        }
        /// <summary>
        /// Adds the fields.
        /// </summary>
        private void AddFields()
        {
            ChkRemember.IsChecked = _displayPreferencesViewModel.RememberSorting;

            var index = 0;

            var currentValue = _displayPreferencesViewModel.SortBy ?? string.Empty;

            foreach (var option in _sortOptions.Keys)
            {
                var optionValue = _sortOptions[option];

                var radio = new RadioButton { GroupName = "Options" };

                radio.Margin = new Thickness(0, 25, 0, 0);

                var textblock = new TextBlock { Text = option };

                textblock.SetResourceReference(StyleProperty, "TextBlockStyle");

                radio.Content = textblock;

                if (string.IsNullOrEmpty(_displayPreferencesViewModel.SortBy))
                {
                    radio.IsChecked = index == 0;
                }
                else
                {
                    radio.IsChecked = currentValue.Equals(optionValue, StringComparison.OrdinalIgnoreCase);
                }

                radio.Tag = optionValue;
                radio.Click += radio_Click;

                PnlOptions.Children.Add(radio);

                index++;
            }

            RadioAscending.IsChecked = _displayPreferencesViewModel.DisplayPreferences.SortOrder ==
                                       SortOrder.Ascending;

            RadioDescending.IsChecked = _displayPreferencesViewModel.DisplayPreferences.SortOrder ==
                               SortOrder.Descending;
        }
        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;
        }
        public PageRoutes()
        {
            InitializeComponent();

            this.Uid = "1003";
            this.Title = string.Format(Translator.GetInstance().GetString("PageRoutes", this.Uid), GameObject.GetInstance().HumanAirline.Profile.Name);

            StackPanel routesPanel = new StackPanel();
            routesPanel.Margin = new Thickness(10, 0, 10, 0);

            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("PageRoutes", txtHeader.Uid);
            routesPanel.Children.Add(txtHeader);

            ContentControl txtRoutesHeader = new ContentControl();
            txtRoutesHeader.ContentTemplate = this.Resources["RoutesHeader"] as DataTemplate;
            txtRoutesHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            routesPanel.Children.Add(txtRoutesHeader);

            routesPanel.Children.Add(createRoutesPanel());
            routesPanel.Children.Add(createButtonsPanel());
            routesPanel.Children.Add(createFleetPanel());
            routesPanel.Children.Add(createRestrictionsPanel());

            StandardContentPanel panelContent = new StandardContentPanel();

            panelContent.setContentPage(routesPanel, StandardContentPanel.ContentLocation.Left);

            panelSideMenu = new StackPanel();

            panelContent.setContentPage(panelSideMenu, StandardContentPanel.ContentLocation.Right);

            base.setContent(panelContent);

            base.setHeaderContent(this.Title);

            showPage(this);

            showFleet();
        }
Пример #17
0
        public PanelFlightSchool(PagePilots parent, FlightSchool flighschool)
        {
            this.ParentPage = parent;
            this.FlightSchool = flighschool;

            InitializeComponent();

            StackPanel panelFlightSchool = 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("PanelFlightSchool", txtHeader.Uid);

            panelFlightSchool.Children.Add(txtHeader);

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

            lbFSInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelFlightSchool", "1002"), UICreator.CreateTextBlock(this.FlightSchool.Name)));
            lbFSInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelFlightSchool", "1003"), UICreator.CreateTextBlock(this.FlightSchool.NumberOfInstructors.ToString())));

            txtStudents = UICreator.CreateTextBlock(this.FlightSchool.NumberOfStudents.ToString());
            lbFSInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelFlightSchool", "1006"), txtStudents));

            txtTrainingAircrafts = UICreator.CreateTextBlock(this.FlightSchool.TrainingAircrafts.Count.ToString());
            lbFSInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelFlightSchool", "1009"), txtTrainingAircrafts));

            panelFlightSchool.Children.Add(lbFSInformation);
            panelFlightSchool.Children.Add(createInstructorsPanel());
            panelFlightSchool.Children.Add(createTrainingAircraftsPanel());
            panelFlightSchool.Children.Add(createStudentsPanel());

            panelFlightSchool.Children.Add(createButtonsPanel());

            this.Content = panelFlightSchool;

            showInstructors();
            showStudents();
            showTrainingAircrafts();
        }
        /// <summary>
        /// Called when [loaded].
        /// </summary>
        protected override void OnLoaded()
        {
            chkRemember.IsChecked = MainPage.DisplayPreferences.RememberSorting;
            
            var index = 0;

            var currentValue = MainPage.SortBy ?? string.Empty;

            foreach (var option in _sortOptions.Keys)
            {
                var optionValue = _sortOptions[option];

                var radio = new ExtendedRadioButton { GroupName = "Options" };

                radio.SetResourceReference(StyleProperty, "ViewMenuRadioButton");

                var textblock = new TextBlock { Text = option };

                textblock.SetResourceReference(StyleProperty, "TextBlockStyle");

                radio.Content = textblock;

                if (string.IsNullOrEmpty(MainPage.DisplayPreferences.SortBy))
                {
                    radio.IsChecked = index == 0;
                }
                else
                {
                    radio.IsChecked = currentValue.Equals(optionValue, StringComparison.OrdinalIgnoreCase);
                }

                radio.Tag = optionValue;
                radio.Click += radio_Click;

                pnlOptions.Children.Add(radio);

                index++;
            }

            base.OnLoaded();
        }
Пример #19
0
        public static StackPanel GetSizeInStrWPF(long bytes)
        {
            StackPanel sp = new StackPanel();
            sp.Orientation = Orientation.Horizontal;
            TextBlock tbSize = new TextBlock();
            TextBlock tbAttr = new TextBlock();
            tbAttr.Margin = new System.Windows.Thickness(5, 0, 0, 0);
            sp.Children.Add(tbSize);
            sp.Children.Add(tbAttr);

            const int scale = 1024;

            OneLanguage lang = LanguagesManager.GetCurrLanguage();
            string[] orders = new string[] { "SFISGB",
                "SFISMB", "SFISKB", "SFISBytes" };

            long max = (long)Math.Pow(scale, orders.Length - 1);

            foreach (string order in orders)
            {
                if (bytes > max)
                {
                    tbSize.Text = string.Format("{0:##.##}", decimal.Divide(bytes, max));
                    //tbAttr.Text = order;

                    tbAttr.SetResourceReference(TextBlock.TextProperty, order);

                    return sp;
                }

                max /= scale;
            }
            tbSize.Text = "0";
            tbAttr.SetResourceReference(TextBlock.TextProperty, "SFISBytes");
            //tbAttr.Text = lang.SFISBytes;

            return sp;

            //return "0 " + lang.SFISBytes;
        }
        public PageAirlinesExtendedStatistics(ViewType view)
        {
            this.View = view;

            InitializeComponent();

            ScrollViewer scroller = new ScrollViewer();
            scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroller.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroller.MaxHeight = GraphicsHelpers.GetContentHeight() - 50;
            scroller.Margin = new Thickness(0, 10, 50, 0);

            StackPanel panelStatistics = new StackPanel();
            panelStatistics.Orientation = Orientation.Vertical;

            TextBlock txtHeader = new TextBlock();
            txtHeader.Margin = new Thickness(0, 0, 0, 0);
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = string.Format(Translator.GetInstance().GetString("PanelAirlinesExtendedStatistics",((int)this.View).ToString()));

            panelStatistics.Children.Add(txtHeader);

            panelStats = new StackPanel();

            panelStatistics.Children.Add(panelStats);

            GameTimer.GetInstance().OnTimeChanged += new GameTimer.TimeChanged(PageAirlinesStatistics_OnTimeChanged);

            this.Unloaded += new RoutedEventHandler(PageAirlinesExtendedStatistics_Unloaded);

            scroller.Content = panelStatistics;

            this.Content = scroller;

            showStats();
        }
        public PopUpSelectOpponents(Airline human, int opponents, int startyear, Region region, Continent continent)
        {
            this.Human = human;
            this.Opponents = opponents;
            this.StartYear = startyear;

            InitializeComponent();
            this.Uid = "1000";

            this.Title = Translator.GetInstance().GetString("PopUpSelectOpponents", this.Uid);

            this.Width = 500;

            this.Height = 500;

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

            StackPanel panelMain = new StackPanel();

            Grid grdMain = UICreator.CreateGrid(2);
            panelMain.Children.Add(grdMain);

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

            TextBlock txtSelectedHeader = new TextBlock();
            txtSelectedHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtSelectedHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush");
            txtSelectedHeader.FontWeight = FontWeights.Bold;
            txtSelectedHeader.Uid = "1001";
            txtSelectedHeader.Text = string.Format(Translator.GetInstance().GetString("PopUpSelectOpponents", txtSelectedHeader.Uid),this.Opponents);

            panelSelectAirlines.Children.Add(txtSelectedHeader);

            lbSelectedAirlines = new ListBox();
            lbSelectedAirlines.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbSelectedAirlines.SetResourceReference(ListBox.ItemTemplateProperty, "AirlineLogoItem");
            lbSelectedAirlines.MaxHeight = 400;
             lbSelectedAirlines.SelectionChanged += lbSelectedAirlines_SelectionChanged;

            panelSelectAirlines.Children.Add(lbSelectedAirlines);

            Grid.SetColumn(panelSelectAirlines, 0);
            grdMain.Children.Add(panelSelectAirlines);

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

            TextBlock txtOpponentsHeader = new TextBlock();
            txtOpponentsHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtOpponentsHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush");
            txtOpponentsHeader.FontWeight = FontWeights.Bold;
            txtOpponentsHeader.Uid = "1002";
            txtOpponentsHeader.Text = Translator.GetInstance().GetString("PopUpSelectOpponents", txtOpponentsHeader.Uid);

            panelOpponents.Children.Add(txtOpponentsHeader);

            lbOpponentAirlines = new ListBox();
            lbOpponentAirlines.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbOpponentAirlines.SetResourceReference(ListBox.ItemTemplateProperty, "AirlineLogoItem");
            lbOpponentAirlines.MaxHeight = 400;
            lbOpponentAirlines.SelectionChanged += lbOpponentAirlines_SelectionChanged;

            panelOpponents.Children.Add(lbOpponentAirlines);

            foreach (Airline airline in Airlines.GetAirlines(a => a.Profile.Founded <= startyear && a.Profile.Folded > startyear && a != this.Human && (a.Profile.Country.Region == region || (continent != null && (continent.Uid == "100"  || continent.hasRegion(a.Profile.Country.Region))))))
                lbOpponentAirlines.Items.Add(airline);

            Grid.SetColumn(panelOpponents, 1);
            grdMain.Children.Add(panelOpponents);

            Button btnOk = new Button();
            btnOk.Uid = "100";
            btnOk.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnOk.Height = Double.NaN;
            btnOk.Width = Double.NaN;
            btnOk.Content = Translator.GetInstance().GetString("General", btnOk.Uid);
            btnOk.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnOk.Margin = new Thickness(5, 5, 0, 0);
            btnOk.Click += btnOk_Click;
            btnOk.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");

            panelMain.Children.Add(btnOk);

            this.Content = panelMain;
        }
        //creates the panel for restrictions
        private StackPanel createRestrictionsPanel()
        {
            StackPanel panelRestrictions = new StackPanel();
            panelRestrictions.Margin = new Thickness(0, 10, 0, 0);

            TextBlock txtHeader = new TextBlock();
            txtHeader.Uid = "1002";
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = Translator.GetInstance().GetString("PageRoutes", txtHeader.Uid);
            panelRestrictions.Children.Add(txtHeader);

            ListBox lbRestrictions = new ListBox();
            lbRestrictions.MaxHeight = GraphicsHelpers.GetContentHeight() / 5;
            lbRestrictions.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbRestrictions.ItemTemplate = this.Resources["RestrictionItem"] as DataTemplate;

            lbRestrictions.ItemsSource = FlightRestrictions.GetRestrictions().FindAll(r => r.StartDate < GameObject.GetInstance().GameTime && r.EndDate > GameObject.GetInstance().GameTime);

            panelRestrictions.Children.Add(lbRestrictions);

            return panelRestrictions;
        }
Пример #23
0
        public PageNewAirline()
        {
            InitializeComponent();

            StackPanel panelContent = new StackPanel();
            panelContent.Margin = new Thickness(10, 0, 10, 0);
            panelContent.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;

            Panel panelLogo = UICreator.CreateGameLogo();
            panelLogo.Margin = new Thickness(0, 0, 0, 20);

            panelContent.Children.Add(panelLogo);

            TextBlock txtHeader = new TextBlock();
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = "Airline Profile";
            panelContent.Children.Add(txtHeader);

            ListBox lbContent = new ListBox();
            lbContent.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbContent.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            panelContent.Children.Add(lbContent);

            txtAirlineName = new TextBox();
            txtAirlineName.Background = Brushes.Transparent;
            txtAirlineName.BorderBrush = Brushes.Black;
            txtAirlineName.Width = 200;
            txtAirlineName.TextChanged+=new TextChangedEventHandler(txtIATA_TextChanged);

            lbContent.Items.Add(new QuickInfoValue("Airline Name", txtAirlineName));

            txtIATA = new TextBox();
            txtIATA.Background = Brushes.Transparent;
            txtIATA.BorderBrush = Brushes.Black;
            txtIATA.MaxLength = 2;
            txtIATA.Width = 25;
            txtIATA.TextChanged += new TextChangedEventHandler(txtIATA_TextChanged);

            lbContent.Items.Add(new QuickInfoValue("IATA Code", txtIATA));

            // chs, 2011-20-10 changed to enable loading of logo

            WrapPanel panelAirlinerType = new WrapPanel();

            RadioButton rbPassenger = new RadioButton();
            rbPassenger.Content = "Passenger";
            rbPassenger.GroupName = "AirlineFocus";
            rbPassenger.IsChecked = true;
            rbPassenger.Tag = Route.RouteType.Passenger;
            rbPassenger.Checked += rbAirlineType_Checked;
            rbPassenger.Margin = new Thickness(5, 0, 0, 0);

            panelAirlinerType.Children.Add(rbPassenger);

            RadioButton rbCargo = new RadioButton();
            rbCargo.Content = "Cargo";
            rbCargo.GroupName = "AirlineFocus";
            rbCargo.Tag = Route.RouteType.Cargo;
            rbCargo.Checked += rbAirlineType_Checked;

            panelAirlinerType.Children.Add(rbCargo);

            lbContent.Items.Add(new QuickInfoValue("Airline type", panelAirlinerType));

            WrapPanel panelAirlineLogo = new WrapPanel();

            imgLogo = new Image();
            imgLogo.Source = new BitmapImage(new Uri(logoPath, UriKind.RelativeOrAbsolute));
            imgLogo.Width = 32;
            imgLogo.Margin = new Thickness(0, 0, 5, 0);
            imgLogo.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            RenderOptions.SetBitmapScalingMode(imgLogo, BitmapScalingMode.HighQuality);

            panelAirlineLogo.Children.Add(imgLogo);

            Button btnLogo = new Button();
            btnLogo.Content = "...";
            btnLogo.Background = Brushes.Transparent;
            btnLogo.Click += new RoutedEventHandler(btnLogo_Click);
            btnLogo.Margin = new Thickness(5, 0, 0, 0);

            panelAirlineLogo.Children.Add(btnLogo);

            lbContent.Items.Add(new QuickInfoValue("Airline Logo", panelAirlineLogo));

            cbColor = new ComboBox();
            cbColor.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbColor.Width = 250;
            cbColor.ItemTemplate = this.Resources["ColorItem"] as DataTemplate;

            foreach (PropertyInfo c in typeof(Colors).GetProperties())
                 cbColor.Items.Add(c);

            cbColor.SelectedIndex = 0;

            lbContent.Items.Add(new QuickInfoValue("Airline Color", cbColor));

            cbCountry = new ComboBox();
            cbCountry.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbCountry.SetResourceReference(ComboBox.ItemTemplateProperty, "CountryFlagLongItem");
            cbCountry.Width = 250;

            List<Country> countries = Countries.GetCountries();
            countries.Sort(delegate(Country c1, Country c2) { return c1.Name.CompareTo(c2.Name); });

            foreach (Country country in countries)
                cbCountry.Items.Add(country);

            cbCountry.SelectedItem = Countries.GetCountry("122");

            lbContent.Items.Add(new QuickInfoValue("Country", cbCountry));

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

            btnCreate = new Button();
            btnCreate.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnCreate.Click += new RoutedEventHandler(btnCreate_Click);
            btnCreate.Height = Double.NaN;
            btnCreate.Width = Double.NaN;
            btnCreate.Content = "Create Airline";
            btnCreate.IsEnabled = false;
            btnCreate.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            panelButtons.Children.Add(btnCreate);

            Button btnCancel = new Button();
            btnCancel.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnCancel.Height = Double.NaN;
            btnCancel.Width = Double.NaN;
            btnCancel.Content = "Cancel";
            btnCancel.Margin = new Thickness(5, 0, 0, 0);
            btnCancel.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnCancel.Click += new RoutedEventHandler(btnCancel_Click);
            panelButtons.Children.Add(btnCancel);

            base.setTopMenu(new PageTopMenu());

            base.hideNavigator();

            base.hideBottomMenu();

            base.setContent(panelContent);

            base.setHeaderContent("Create New Airline");

            showPage(this);

            airlinerType = Route.RouteType.Passenger;
        }
        //creates the airlines statistics
        private StackPanel createStatisticsPanel(string methodName, string name, Boolean financial, Boolean thousands)
        {
            StackPanel panelStatistics = new StackPanel();
            panelStatistics.Margin = new Thickness(0, 0, 0, 5);

            TextBlock txtHeader = new TextBlock();
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = name;

            panelStatistics.Children.Add(txtHeader);

            ListBox lbStatistics = new ListBox();
            lbStatistics.ItemContainerStyleSelector = new ListBoxItemStyleSelector();

            // chs, 2011-22-10 changed so financial statistics are shown in currency
            if (financial && !thousands)
                lbStatistics.ItemTemplate = this.Resources["AirlineFinancialStatItem"] as DataTemplate;
            else if (financial && thousands)
                lbStatistics.ItemTemplate = this.Resources["AirlineThousandsStatItem"] as DataTemplate;
            else
                lbStatistics.ItemTemplate = this.Resources["AirlineStatItem"] as DataTemplate;

            double maxValue = getMaxValue(methodName);

            double coff = this.StatWidth / maxValue;

            List<Airline> airlines = Airlines.GetAllAirlines().FindAll(a => !a.IsSubsidiary);
            airlines.Sort((delegate(Airline a1, Airline a2) { return a1.Profile.Name.CompareTo(a2.Profile.Name); }));

            foreach (Airline airline in airlines)
            {

                MethodInfo method = typeof(Airline).GetMethod(methodName);
                long value = Convert.ToInt64(method.Invoke(airline, null));

                lbStatistics.Items.Add(new AirlineStatisticsItem(airline, (int)value, Math.Max(1, (int)Convert.ToDouble(value * coff))));

                foreach (SubsidiaryAirline sAirline in airline.Subsidiaries)
                {
                    long sValue = Convert.ToInt64(method.Invoke(sAirline, null));

                    lbStatistics.Items.Add(new AirlineStatisticsItem(sAirline, (int)sValue, Math.Max(1, (int)Convert.ToDouble(sValue * coff))));
                }

            }

            panelStatistics.Children.Add(lbStatistics);

            return panelStatistics;
        }
        public PageExtendedSearchAirports(PageAirports parent)
        {
            this.ParentPage = parent;

            InitializeComponent();

            StackPanel panelSearch = new StackPanel();
            panelSearch.Margin = new Thickness(0, 10, 50, 0);

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

            panelSearch.Children.Add(txtHeader);

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

            panelSearch.Children.Add(lbContent);

            cbAirport = new ComboBox();
            cbAirport.SetResourceReference(ComboBox.ItemTemplateProperty, "AirportCountryItem");
            cbAirport.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAirport.IsSynchronizedWithCurrentItem = true;
            cbAirport.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbAirport.Width = 200;

            List<Airport> airportsList = Airports.GetAllActiveAirports();

            ICollectionView airportsView = CollectionViewSource.GetDefaultView(airportsList);
            airportsView.SortDescriptions.Add(new SortDescription("Profile.Name", ListSortDirection.Ascending));

            cbAirport.ItemsSource = airportsView;
            cbAirport.SelectedIndex = 0;

            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageExtendedSearchAirports", "1002"), cbAirport));

            WrapPanel panelDistance = new WrapPanel();

            cbCompareDistance = new ComboBox();
            createCompareComboBox(cbCompareDistance);
            panelDistance.Children.Add(cbCompareDistance);

            txtDistance = new TextBox();
            txtDistance.PreviewTextInput += new TextCompositionEventHandler(txtDistance_PreviewTextInput);
            txtDistance.Width = 100;
            txtDistance.TextAlignment = TextAlignment.Right;
            txtDistance.Background = Brushes.Transparent;
            panelDistance.Children.Add(txtDistance);

            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageExtendedSearchAirports", "1004"), panelDistance));

            WrapPanel panelButtons = new WrapPanel();
            panelButtons.Margin = new Thickness(0, 5, 0, 0);
            panelButtons.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

            panelSearch.Children.Add(panelButtons);

            Button btnSearch = new Button();
            btnSearch.Uid = "109";
            btnSearch.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnSearch.Height = Double.NaN;
            btnSearch.Width = Double.NaN;
            btnSearch.IsDefault = true;
            btnSearch.Content = Translator.GetInstance().GetString("General", btnSearch.Uid);
            btnSearch.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnSearch.Click += new RoutedEventHandler(btnSearch_Click);

            panelButtons.Children.Add(btnSearch);

            this.Content = panelSearch;
        }
        //creates the panel to transfer funds between airlines
        private StackPanel createTransferFundsPanel()
        {
            panelTransferFunds = new StackPanel();
            panelTransferFunds.Margin = new Thickness(0, 5, 0, 0);
            panelTransferFunds.Visibility = this.Airline.Subsidiaries.Count > 0 ? Visibility.Visible : System.Windows.Visibility.Collapsed;

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

            panelTransferFunds.Children.Add(txtHeader);

            WrapPanel panelTransferAirlines = new WrapPanel();
            panelTransferAirlines.Margin = new Thickness(0, 5, 0, 0);
            panelTransferFunds.Children.Add(panelTransferAirlines);

            cbAirlineFrom = new ComboBox();
            cbAirlineFrom.SelectionChanged += cbAirlineFrom_SelectionChanged;
            cbAirlineFrom.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAirlineFrom.SetResourceReference(ComboBox.ItemTemplateProperty, "AirlineLogoItem");
            cbAirlineFrom.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbAirlineFrom.Width = 200;

            cbAirlineFrom.Items.Add(GameObject.GetInstance().MainAirline);

            foreach (Airline airline in GameObject.GetInstance().MainAirline.Subsidiaries)
                cbAirlineFrom.Items.Add(airline);

            panelTransferAirlines.Children.Add(cbAirlineFrom);

            panelTransferAirlines.Children.Add(UICreator.CreateTextBlock("->"));

            cbAirlineTo = new ComboBox();
            cbAirlineTo.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAirlineTo.SetResourceReference(ComboBox.ItemTemplateProperty, "AirlineLogoItem");
            cbAirlineTo.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbAirlineTo.Width = 200;

            cbAirlineTo.Items.Add(GameObject.GetInstance().MainAirline);

            foreach (Airline airline in GameObject.GetInstance().MainAirline.Subsidiaries)
                cbAirlineTo.Items.Add(airline);

            cbAirlineTo.SelectedItem = GameObject.GetInstance().HumanAirline;

            panelTransferAirlines.Children.Add(cbAirlineTo);

            panelTransferFunds.Children.Add(createMoneySlider());

            Button btnTransferFunds = new Button();
            btnTransferFunds.Uid = "201";
            btnTransferFunds.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnTransferFunds.Height = Double.NaN;
            btnTransferFunds.Width = Double.NaN;
            btnTransferFunds.Content = Translator.GetInstance().GetString("PageAirlineSubsidiaries", btnTransferFunds.Uid);
            btnTransferFunds.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnTransferFunds.Margin = new Thickness(0, 5, 0, 0);
            btnTransferFunds.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnTransferFunds.Click += btnTransferFunds_Click;

            panelTransferFunds.Children.Add(btnTransferFunds);

            cbAirlineFrom.SelectedItem = GameObject.GetInstance().HumanAirline;

            return panelTransferFunds;
        }
        //creates the quick info panel for the airline
        private Panel createQuickInfoPanel()
        {
            StackPanel panelInfo = new StackPanel();
            panelInfo.Margin = new Thickness(5, 0, 10, 0);

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

            panelInfo.Children.Add(txtHeader);

            DockPanel grdQuickInfo = new DockPanel();
            //grdQuickInfo.Margin = new Thickness(0, 5, 0, 0);

            panelInfo.Children.Add(grdQuickInfo);

            Image imgLogo = new Image();
            imgLogo.Source = new BitmapImage(new Uri(this.Airline.Profile.Logo, UriKind.RelativeOrAbsolute));
            imgLogo.Width = 110;
            imgLogo.Margin = new Thickness(0, 0, 5, 0);
            imgLogo.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            RenderOptions.SetBitmapScalingMode(imgLogo, BitmapScalingMode.HighQuality);
            grdQuickInfo.Children.Add(imgLogo);

            StackPanel panelQuickInfo = new StackPanel();

            grdQuickInfo.Children.Add(panelQuickInfo);

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

            panelQuickInfo.Children.Add(lbQuickInfo);

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1002"), UICreator.CreateTextBlock(this.Airline.Profile.Name)));

            if (this.Airline.IsSubsidiary)
            {
                ContentControl ccParent = new ContentControl();
                ccParent.SetResourceReference(ContentControl.ContentTemplateProperty, "AirlineLogoLink");
                ccParent.Content = ((SubsidiaryAirline)this.Airline).Airline;

                lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1021"), ccParent));

            }
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1003"), UICreator.CreateTextBlock(this.Airline.Profile.IATACode)));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1004"), UICreator.CreateTextBlock(this.Airline.Profile.CEO)));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1024"), UICreator.CreateTextBlock(this.Airline.Profile.Founded.ToString())));

            ContentControl lblFlag = new ContentControl();
            lblFlag.SetResourceReference(ContentControl.ContentTemplateProperty, "CountryFlagLongItem");
            lblFlag.Content = new CountryCurrentCountryConverter().Convert(this.Airline.Profile.Country);

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1005"), lblFlag));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1006"), UICreator.CreateColorRect(this.Airline.Profile.Color)));

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline","1027"),UICreator.CreateTextBlock(new TextUnderscoreConverter().Convert(this.Airline.AirlineRouteFocus).ToString())));
            // chs, 2011-10-10 added fleet size to the airline profile
            TextBlock txtFleetSize = UICreator.CreateTextBlock(string.Format("{0} (+{1} in order)", this.Airline.DeliveredFleet.Count, this.Airline.Fleet.Count - this.Airline.DeliveredFleet.Count));

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1007"), txtFleetSize));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1011"), UICreator.CreateTextBlock(string.Format("{0} / {1}", this.Airline.Airports.Count, Airports.GetAllAirports().Sum(a => a.getHubs().Count(h => h.Airline == this.Airline))))));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1008"), createAirlineValuePanel()));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1009"), createAirlineReputationPanel()));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1010"), UICreator.CreateTextBlock(String.Format("{0:0.00} %", PassengerHelpers.GetPassengersHappiness(this.Airline)))));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1012"), UICreator.CreateTextBlock(this.Airline.Alliances.Count > 0 ? string.Join(", ", from a in this.Airline.Alliances select a.Name) : Translator.GetInstance().GetString("PageAirline", "1013"))));

            WrapPanel panelLicens = new WrapPanel();

            txtLicense = UICreator.CreateTextBlock(new TextUnderscoreConverter().Convert(this.Airline.License).ToString());
            txtLicense.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            panelLicens.Children.Add(txtLicense);

            if (this.Airline.IsHuman && this.Airline.License != Airline.AirlineLicense.Long_Haul)
            {

                btnUpgradeLicense = new Button();
                btnUpgradeLicense.Margin = new Thickness(5, 0, 0, 0);
                btnUpgradeLicense.Background = Brushes.Transparent;
                btnUpgradeLicense.Click += btnUpgradeLicense_Click;
                btnUpgradeLicense.ToolTip = UICreator.CreateToolTip("1014");

                Image imgUpgradeLicens = new Image();
                imgUpgradeLicens.Source = new BitmapImage(new Uri(@"/Data/images/add.png", UriKind.RelativeOrAbsolute));
                imgUpgradeLicens.Height = 16;
                RenderOptions.SetBitmapScalingMode(imgUpgradeLicens, BitmapScalingMode.HighQuality);

                btnUpgradeLicense.Content = imgUpgradeLicens;

                panelLicens.Children.Add(btnUpgradeLicense);
            }

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1025"), panelLicens));

            return panelInfo;
        }
        //creates the panel for purchasing an airline
        private StackPanel createPurchaseAirlinePanel()
        {
            double buyingPrice = this.Airline.getValue() * 1000000 * 1.10;
            StackPanel purchasePanel = new StackPanel();
            purchasePanel.Margin = new Thickness(5, 10, 10, 10);

            TextBlock txtHeader = new TextBlock();
            txtHeader.Uid = "1022";
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush");
            txtHeader.TextAlignment = TextAlignment.Left;
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = string.Format("{0} ({1:C})", Translator.GetInstance().GetString("PageAirline", txtHeader.Uid), buyingPrice);

            purchasePanel.Children.Add(txtHeader);

            WrapPanel panelButtons = new WrapPanel();

            Button btnPurchase = new Button();
            btnPurchase.Uid = "1023";
            btnPurchase.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnPurchase.Height = Double.NaN;
            btnPurchase.Width = Double.NaN;
            btnPurchase.Content = Translator.GetInstance().GetString("PageAirline", btnPurchase.Uid);
            btnPurchase.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnPurchase.IsEnabled = GameObject.GetInstance().HumanAirline.Money > buyingPrice;
            btnPurchase.Click += new RoutedEventHandler(btnPurchase_Click);
            btnPurchase.ToolTip = UICreator.CreateToolTip("1015");

            panelButtons.Children.Add(btnPurchase);

            Button btnPurchaseAsSubsidiary = new Button();
            btnPurchaseAsSubsidiary.Uid = "1026";
            btnPurchaseAsSubsidiary.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnPurchaseAsSubsidiary.Height = Double.NaN;
            btnPurchaseAsSubsidiary.Width = Double.NaN;
            btnPurchaseAsSubsidiary.Content = Translator.GetInstance().GetString("PageAirline", btnPurchaseAsSubsidiary.Uid);
            btnPurchaseAsSubsidiary.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnPurchaseAsSubsidiary.IsEnabled = GameObject.GetInstance().HumanAirline.Money > buyingPrice;
            btnPurchaseAsSubsidiary.Margin = new Thickness(5, 0, 0, 0);
            btnPurchaseAsSubsidiary.Click += btnPurchaseAsSubsidiary_Click;
            btnPurchaseAsSubsidiary.ToolTip = UICreator.CreateToolTip("1016");

            panelButtons.Children.Add(btnPurchaseAsSubsidiary);

            purchasePanel.Children.Add(panelButtons);

            return purchasePanel;
        }
        //creates the panel for the manufacturer contract
        private StackPanel createManufacturerContractPanel()
        {
            StackPanel panelContract = new StackPanel();
            panelContract.Margin = new Thickness(5, 10, 10, 10);

            TextBlock txtHeader = new TextBlock();
            txtHeader.Uid = "1014";
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush");
            txtHeader.TextAlignment = TextAlignment.Left;
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = Translator.GetInstance().GetString("PageAirline", txtHeader.Uid);

            panelContract.Children.Add(txtHeader);

            ListBox lbContract = new ListBox();
            lbContract.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbContract.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            panelContract.Children.Add(lbContract);

            lbContract.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1015"), UICreator.CreateTextBlock(this.Airline.Contract.Manufacturer.Name)));
            lbContract.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1016"), UICreator.CreateTextBlock(this.Airline.Contract.SigningDate.ToShortDateString())));
            lbContract.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1017"), UICreator.CreateTextBlock(this.Airline.Contract.ExpireDate.ToShortDateString())));
            lbContract.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1018"), UICreator.CreateTextBlock(string.Format("{0:0.00} %", this.Airline.Contract.Discount))));
            lbContract.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirline", "1019"), UICreator.CreateTextBlock(string.Format("{0} / {1}", this.Airline.Contract.PurchasedAirliners, this.Airline.Contract.Airliners))));

            return panelContract;
        }
        //creates the panel for the human controlling airline
        private StackPanel createHumanControllingPanel()
        {
            StackPanel panelMain = new StackPanel();
            panelMain.Margin = new Thickness(5, 5, 10, 0);

            TextBlock txtHeader = new TextBlock();
            txtHeader.Uid = "1020";
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush");
            txtHeader.TextAlignment = TextAlignment.Left;
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = Translator.GetInstance().GetString("PageAirline", txtHeader.Uid);

            panelMain.Children.Add(txtHeader);

            WrapPanel panelChangeControl = new WrapPanel();

            panelMain.Children.Add(panelChangeControl);

            cbControlling = new ComboBox();
            cbControlling.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbControlling.SetResourceReference(ComboBox.ItemTemplateProperty, "AirlineLogoItem");
            cbControlling.Width = 250;
            cbControlling.Items.Add(GameObject.GetInstance().MainAirline);

            foreach (Airline airline in GameObject.GetInstance().MainAirline.Subsidiaries)
                cbControlling.Items.Add(airline);

            cbControlling.SelectedItem = GameObject.GetInstance().HumanAirline;

            panelChangeControl.Children.Add(cbControlling);

            btnOk = new Button();
            btnOk.Uid = "116";
            btnOk.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnOk.Height = Double.NaN;
            btnOk.Width = Double.NaN;
            btnOk.Content = Translator.GetInstance().GetString("General", btnOk.Uid);
            btnOk.IsEnabled = cbControlling.Items.Count > 1;
            btnOk.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnOk.Margin = new Thickness(5, 0, 0, 0);
            btnOk.Click += new RoutedEventHandler(btnOk_Click);

            panelChangeControl.Children.Add(btnOk);

            return panelMain;
        }