当前位置: 首页>>代码示例>>C#>>正文


C# ListBox.SetResourceReference方法代码示例

本文整理汇总了C#中System.Windows.Controls.ListBox.SetResourceReference方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.SetResourceReference方法的具体用法?C# ListBox.SetResourceReference怎么用?C# ListBox.SetResourceReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.ListBox的用法示例。


在下文中一共展示了ListBox.SetResourceReference方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PopUpTerminal

        //for creating a new terminal
        public PopUpTerminal(Airport airport)
        {
            this.Airport = airport;

            InitializeComponent();

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

            this.Width = 400;

            this.Height = 200;

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

            StackPanel mainPanel = new StackPanel();
            mainPanel.Margin = new Thickness(10, 10, 10, 10);

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

            mainPanel.Children.Add(lbTerminal);

            // chs 28-01-12: added for name of terminal
            txtName = new TextBox();
            txtName.Background = Brushes.Transparent;
            txtName.BorderBrush = Brushes.Black;
            txtName.IsEnabled = this.Terminal == null;
            txtName.Width = 100;
            txtName.Text = this.Terminal == null ? "Terminal" : this.Terminal.Name;
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal","1007"),txtName));

            // chs 11-09-11: added numericupdown for selecting number of gates
            nudGates = new ucNumericUpDown();
            nudGates.Height = 30;
            nudGates.MaxValue = 50;
            nudGates.ValueChanged+=new RoutedPropertyChangedEventHandler<decimal>(nudGates_ValueChanged);
            nudGates.MinValue = 1;

            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1001"), nudGates));
            /*
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1002"), UICreator.CreateTextBlock(string.Format("{0:C}",this.Airport.getTerminalPrice()))));
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1003"), UICreator.CreateTextBlock(string.Format("{0:C}",this.Airport.getTerminalGatePrice()))));
            */
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1002"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airport.getTerminalPrice()).ToString())));
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1003"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airport.getTerminalGatePrice()).ToString())));

            txtDaysToCreate = UICreator.CreateTextBlock("0 days");
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1004"), txtDaysToCreate));

            txtTotalPrice = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(0).ToString());//UICreator.CreateTextBlock(string.Format("{0:C}", 0));
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1005"), txtTotalPrice));

            mainPanel.Children.Add(createButtonsPanel());

            nudGates.Value = 1;

            this.Content = mainPanel;
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:61,代码来源:PopUpTerminal.xaml.cs

示例2: PageAirlinePilots

        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();
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:34,代码来源:PageAirlinePilots.xaml.cs

示例3: PopUpBuildRunway

        public PopUpBuildRunway(Airport airport)
        {
            this.Airport = airport;
            InitializeComponent();

            this.Uid = "1000";

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

            this.Width = 400;

            this.Height = 210;

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

            StackPanel mainPanel = new StackPanel();
            mainPanel.Margin = new Thickness(10, 10, 10, 10);

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

            txtName = new TextBox();
            txtName.Width = 200;
            txtName.Background = Brushes.Transparent;
            txtName.TextChanged += new TextChangedEventHandler(txtName_TextChanged);

            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpBuildRunway", "1001"), txtName));

            cbSurface = new ComboBox();
            cbSurface.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbSurface.Width = 100;
            cbSurface.SelectedIndex = 0;

            foreach (Runway.SurfaceType surface in this.Airport.Runways.Select(r => r.Surface).Distinct())
                cbSurface.Items.Add(surface);

            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpBuildRunway", "1002"), cbSurface));

            cbLenght = new ComboBox();
            cbLenght.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbLenght.Width = 100;
            //cbLenght.ItemStringFormat = new NumberMeterToUnitConverter().Convert("{0}").ToString();
            cbLenght.SelectedIndex = 0;

            for (int i = 1500; i < 4500; i += 250)
                cbLenght.Items.Add(i);

            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpBuildRunway", "1003"), cbLenght));

            mainPanel.Children.Add(createButtonsPanel());

            this.Content = mainPanel;
        }
开发者ID:pedromorgan,项目名称:theairlineproject-cs,代码行数:55,代码来源:PopUpBuildRunway.xaml.cs

示例4: PopUpDifficulty

        public PopUpDifficulty(DifficultyLevel level)
        {
            this.Level = level;

            InitializeComponent();

            this.Uid = "1000";

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

            this.Width = 400;

            this.Height = 210;

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

            StackPanel mainPanel = new StackPanel();
            mainPanel.Margin = new Thickness(10, 10, 10, 10);

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

            DifficultyLevel easyLevel = DifficultyLevels.GetDifficultyLevel("Easy");
            DifficultyLevel normalLevel = DifficultyLevels.GetDifficultyLevel("Normal");
            DifficultyLevel hardLevel = DifficultyLevels.GetDifficultyLevel("Hard");

            slMoney = createDifficultySlider(easyLevel.MoneyLevel, normalLevel.MoneyLevel, hardLevel.MoneyLevel,level.MoneyLevel);
            slLoan = createDifficultySlider(easyLevel.LoanLevel, normalLevel.LoanLevel, hardLevel.LoanLevel,level.LoanLevel);
            slAI = createDifficultySlider(easyLevel.AILevel, normalLevel.AILevel, hardLevel.AILevel,level.AILevel);
            slPassengers = createDifficultySlider(easyLevel.PassengersLevel, normalLevel.PassengersLevel, hardLevel.PassengersLevel,level.PassengersLevel);
            slPrice = createDifficultySlider(easyLevel.PriceLevel, normalLevel.PriceLevel, hardLevel.PriceLevel,level.PriceLevel);
            slStartData = createDifficultySlider(easyLevel.StartDataLevel, normalLevel.StartDataLevel, hardLevel.StartDataLevel, level.StartDataLevel);

            lbContent.Items.Add(new QuickInfoValue("", createIndicator()));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty","200"), slMoney));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "201"), slPrice));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "202"), slLoan));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "203"), slPassengers));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "204"), slAI));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty","205"),slStartData));

            mainPanel.Children.Add(createButtonsPanel());

            this.Content = mainPanel;
        }
开发者ID:pedromorgan,项目名称:theairlineproject-cs,代码行数:47,代码来源:PopUpDifficulty.xaml.cs

示例5: PanelPilot

        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;
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:46,代码来源:PanelPilot.xaml.cs

示例6: PanelFlightSchool

        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();
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:44,代码来源:PanelFlightSchool.xaml.cs

示例7: PageAirlineStatistics

        public PageAirlineStatistics(Airline airline)
        {
            InitializeComponent();

            this.Airline = airline;

            StackPanel panelStatistics = new StackPanel();
            panelStatistics.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("PageAirlineStatistics", txtHeader.Uid);

            panelStatistics.Children.Add(txtHeader);

            ContentControl ccHeader = new ContentControl();
            ccHeader.ContentTemplate = this.Resources["StatHeader"] as DataTemplate;
            ccHeader.Content = new KeyValuePair<int, int>(GameObject.GetInstance().GameTime.Year - 1, GameObject.GetInstance().GameTime.Year);

            panelStatistics.Children.Add(ccHeader);

            lbStats = new ListBox();
            lbStats.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbStats.ItemTemplate = this.Resources["StatItem"] as DataTemplate;

            panelStatistics.Children.Add(lbStats);

            if (this.Airline.IsHuman)
                panelStatistics.Children.Add(createHumanStatisticsPanel());

            TextBlock txtRatingsHeader = new TextBlock();
            txtRatingsHeader.Uid ="1018";
            txtRatingsHeader.Margin = new Thickness(0,10,0,0);
            txtRatingsHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtRatingsHeader.SetResourceReference(TextBlock.BackgroundProperty,"HeaderBackgroundBrush2");
            txtRatingsHeader.FontWeight = FontWeights.Bold;
            txtRatingsHeader.Text = Translator.GetInstance().GetString("PageAirlineStatistics",txtRatingsHeader.Uid);

            panelStatistics.Children.Add(txtRatingsHeader);

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

            panelStatistics.Children.Add(lbRatings);

            showStats();
            showRatings();

            this.Content = panelStatistics;
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:55,代码来源:PageAirlineStatistics.xaml.cs

示例8: createHumanStatisticsPanel

        //creates the panel for the human statistics
        private StackPanel createHumanStatisticsPanel()
        {
            StackPanel panelHumanStatistics = new StackPanel();
            panelHumanStatistics.Margin = new Thickness(0, 10, 0, 0);

            TextBlock txtHeader = new TextBlock();
            txtHeader.Uid = "1005";
            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("PageAirlineStatistics", txtHeader.Uid);

            panelHumanStatistics.Children.Add(txtHeader);

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

            panelHumanStatistics.Children.Add(lbHumanStats);

            lbHumanStats.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineStatistics", "1006"), UICreator.CreateTextBlock(string.Format("{0:0.00} %", StatisticsHelpers.GetHumanOnTime()))));
            lbHumanStats.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineStatistics", "1007"), UICreator.CreateTextBlock(string.Format("{0:0.00} %", StatisticsHelpers.GetHumanFillAverage()*100))));
            lbHumanStats.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineStatistics", "1008"), UICreator.CreateTextBlock(string.Format("{0:0.00} %", Ratings.GetCustomerHappiness(GameObject.GetInstance().HumanAirline)))));
            lbHumanStats.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineStatistics", "1009"), UICreator.CreateTextBlock(string.Format("{0:0.00}", StatisticsHelpers.GetHumanAvgTicketPPD()))));
            lbHumanStats.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineStatistics", "1012"), UICreator.CreateTextBlock(string.Format("{0:0.00} %", Ratings.GetEmployeeHappiness(GameObject.GetInstance().HumanAirline)))));
            return panelHumanStatistics;
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:29,代码来源:PageAirlineStatistics.xaml.cs

示例9: PageSearchAirports

        public PageSearchAirports(PageAirports parent)
        {
            InitializeComponent();

            this.ParentPage = parent;

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

            panelSearch.Children.Add(txtHeader);

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

            WrapPanel panelCheckBoxes = new WrapPanel();
            lbSearch.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSearchAirports","1004"), panelCheckBoxes));

            cbHumanAirports = new CheckBox();
            cbHumanAirports.Uid = "1002";
            cbHumanAirports.Content = Translator.GetInstance().GetString("PageSearchAirports", cbHumanAirports.Uid);
            cbHumanAirports.IsChecked = false;
            cbHumanAirports.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbHumanAirports.FlowDirection = System.Windows.FlowDirection.RightToLeft;

            panelCheckBoxes.Children.Add(cbHumanAirports);

            cbHubs = new CheckBox();
            cbHubs.Uid = "1003";
            cbHubs.Content = Translator.GetInstance().GetString("PageSearchAirports", cbHubs.Uid);
            cbHubs.IsChecked = false;
            cbHubs.FlowDirection = System.Windows.FlowDirection.RightToLeft;
            cbHubs.Margin = new Thickness(5, 0, 0, 0);

            panelCheckBoxes.Children.Add(cbHubs);

            cbRegion = new ComboBox();
            cbRegion.DisplayMemberPath = "Name";
            cbRegion.SelectedValuePath = "Name";
            cbRegion.Width = 250;
            cbRegion.Background = Brushes.Transparent;
            cbRegion.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbRegion.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbRegion.SelectionChanged += new SelectionChangedEventHandler(cbRegions_SelectionChanged);

            List<Region> regions = Regions.GetRegions();
            regions.Sort(delegate(Region r1, Region r2){return r1.Name.CompareTo(r2.Name);});

            // 100 is the predefined Uid for "All Regions"
            Region regionAll = Regions.GetRegion("100");
            cbRegion.Items.Add(regionAll);

            foreach (Region region in regions)
                cbRegion.Items.Add(region);

            lbSearch.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSearchAirports", "1005"), cbRegion));

            cbCountry = new ComboBox();
            cbCountry.SetResourceReference(ComboBox.ItemTemplateProperty, "CountryFlagLongItem");
            cbCountry.Width = 250;
            //cbCountries.Style = this.Resources["ComboBoxStyle"] as Style;
            cbCountry.Background = Brushes.Transparent;
            cbCountry.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbCountry.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

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

            // 100 is the predefined Uid for "All Countries"
            Country countryAll = Countries.GetCountry("100");
            cbCountry.Items.Add(countryAll);

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

            cbCountry.SelectedItem = countryAll;
            cbRegion.SelectedItem = regionAll;

            lbSearch.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSearchAirports", "1006"), cbCountry));

            WrapPanel panelSizes = new WrapPanel();

            cbCompareSize = new ComboBox();
            createCompareComboBox(cbCompareSize);
            panelSizes.Children.Add(cbCompareSize);

            cbSize = new ComboBox();
            cbSize.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbSize.Background = Brushes.Transparent;
            cbSize.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbSize.SetResourceReference(ComboBox.ItemTemplateProperty, "TextUnderscoreTextBlock");
            cbSize.Width = 100;
//.........这里部分代码省略.........
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:101,代码来源:PageSearchAirports.xaml.cs

示例10: createQuickInfoPanel

        //creates the quick info panel for the fleet airliner
        private ScrollViewer createQuickInfoPanel()
        {
            ScrollViewer scroller = new ScrollViewer();
            scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroller.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroller.MaxHeight = GraphicsHelpers.GetContentHeight() / 3;

            StackPanel panelInfo = new StackPanel();

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

            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.Airliner.Airliner.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);

            DockPanel panelName = new DockPanel();

            txtName = UICreator.CreateTextBlock(this.Airliner.Name);
            txtName.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            panelName.Children.Add(txtName);

            Image imgEditName = new Image();
            imgEditName.Source = new BitmapImage(new Uri(@"/Data/images/edit.png", UriKind.RelativeOrAbsolute));
            imgEditName.Width = 16;

            RenderOptions.SetBitmapScalingMode(imgEditName, BitmapScalingMode.HighQuality);

            Button btnEditName = new Button();
            btnEditName.Background = Brushes.Transparent;
            btnEditName.Margin = new Thickness(5, 0, 0, 0);
            btnEditName.Visibility = Visibility.Collapsed;// this.Airliner.Airliner.Airline.IsHuman ? Visibility.Visible : System.Windows.Visibility.Collapsed;
            //btnEditName.Click += new RoutedEventHandler(btnEditName_Click);
            btnEditName.Content = imgEditName;

            panelName.Children.Add(btnEditName);

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageFleetAirliner", "1002"), panelName));

            DockPanel panelOwner = new DockPanel();

            TextBlock lnkOwner = UICreator.CreateLink(this.Airliner.Airliner.Airline.Profile.Name);
            lnkOwner.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            ((Hyperlink)lnkOwner.Inlines.FirstInline).Click += new RoutedEventHandler(PageFleetAirliner_Click);

            panelOwner.Children.Add(lnkOwner);

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

            Button btnEditOwner = new Button();
            btnEditOwner.Background = Brushes.Transparent;
            btnEditOwner.Margin = new Thickness(5, 0, 0, 0);
            btnEditOwner.Visibility = this.Airliner.Airliner.Airline.IsHuman && this.Airliner.Status == FleetAirliner.AirlinerStatus.Stopped && GameObject.GetInstance().MainAirline.Subsidiaries.Count > 0 && !this.Airliner.HasRoute ? Visibility.Visible : System.Windows.Visibility.Collapsed;
            btnEditOwner.Click += new RoutedEventHandler(btnEditOwner_Click);
            btnEditOwner.Content = imgEditOwner;

            panelOwner.Children.Add(btnEditOwner);

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageFleetAirliner", "1017"), panelOwner));

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageFleetAirliner", "1025"), UICreator.CreateTextBlock(this.Airliner.PurchasedDate.ToShortDateString())));

            DockPanel panelHomeBase = new DockPanel();

            Button btnEditHomeBase = new Button();
            btnEditHomeBase.Background = Brushes.Transparent;
            btnEditHomeBase.Click += new RoutedEventHandler(btnEditHomeBase_Click);
            btnEditHomeBase.Margin = new Thickness(0, 0, 5, 0);

            Image imgEdit = new Image();
            imgEdit.Source = new BitmapImage(new Uri(@"/Data/images/edit.png", UriKind.RelativeOrAbsolute));
//.........这里部分代码省略.........
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:101,代码来源:PageFleetAirliner.xaml.cs

示例11: PageNewGame

        public PageNewGame()
        {
            OpponentType = OpponentSelect.Random;

            InitializeComponent();

            popUpSplash = new Popup();

            popUpSplash.Child = UICreator.CreateSplashWindow();
            popUpSplash.Placement = PlacementMode.Center;
            popUpSplash.PlacementTarget = PageNavigator.MainWindow;
            popUpSplash.IsOpen = false;

            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.Uid = "1001";
            txtHeader.Text = Translator.GetInstance().GetString("PageNewGame", txtHeader.Uid);
            panelContent.Children.Add(txtHeader);

            lbContentBasics = new ListBox();
            lbContentBasics.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbContentBasics.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            lbContentBasics.MaxHeight = GraphicsHelpers.GetContentHeight() / 2;

            txtNarrative = new TextBox();
            txtNarrative.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            txtNarrative.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            txtNarrative.Background = Brushes.Transparent;
            txtNarrative.TextWrapping = TextWrapping.Wrap;
            txtNarrative.FontStyle = FontStyles.Italic;
            txtNarrative.Width = 500;
            txtNarrative.Height = 100;
            txtNarrative.Uid = "1015";
            txtNarrative.IsReadOnly = true;
            txtNarrative.Text = Translator.GetInstance().GetString("PageNewGame", txtNarrative.Uid);
            txtNarrative.Visibility = System.Windows.Visibility.Collapsed;

            panelContent.Children.Add(txtNarrative);

            panelContent.Children.Add(lbContentBasics);

            lbContentHuman = new ListBox();
            lbContentHuman.Visibility = System.Windows.Visibility.Collapsed;
            lbContentHuman.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            lbContentHuman.MaxHeight = GraphicsHelpers.GetContentHeight() / 2;
            lbContentHuman.Visibility = System.Windows.Visibility.Collapsed;

            panelContent.Children.Add(lbContentHuman);

            cbContinent = new ComboBox();
            cbContinent.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbContinent.Width = 200;
            cbContinent.DisplayMemberPath = "Name";
            cbContinent.SelectedValuePath = "Name";

            cbContinent.Items.Add(new Continent("100","All continents"));

            foreach (Continent continent in Continents.GetContinents().OrderBy(c => c.Name))
                cbContinent.Items.Add(continent);

            cbContinent.SelectionChanged+=cbContinent_SelectionChanged;
            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame","1022"),cbContinent));

            cbRegion = new ComboBox();
            cbRegion.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbRegion.Width = 200;
            cbRegion.DisplayMemberPath = "Name";
            cbRegion.SelectedValuePath = "Name";

            cbRegion.Items.Add(Regions.GetRegion("100"));
            foreach (Region region in Regions.GetRegions().FindAll(r => Airlines.GetAirlines(r).Count > 0).OrderBy(r => r.Name))
                cbRegion.Items.Add(region);

            cbRegion.SelectionChanged += new SelectionChangedEventHandler(cbRegion_SelectionChanged);

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1012"), cbRegion));
            // chs, 2011-19-10 added for the possibility of creating a new airline
            WrapPanel panelAirline = new WrapPanel();

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

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

//.........这里部分代码省略.........
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:101,代码来源:PageNewGame.xaml.cs

示例12: createQuickInfoPanel

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

//.........这里部分代码省略.........
开发者ID:pedromorgan,项目名称:theairlineproject-cs,代码行数:101,代码来源:PageAirline.xaml.cs

示例13: PanelUsedAirliner

        private ComboBox cbAirport; // cbName;

        #endregion Fields

        #region Constructors

        public PanelUsedAirliner(PageAirliners parent, Airliner airliner)
            : base(parent)
        {
            this.Airliner = airliner;

            StackPanel panelAirliner = new StackPanel();

            panelAirliner.Children.Add(PanelAirliner.createQuickInfoPanel(airliner.Type));

            this.addObject(panelAirliner);

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

            this.addObject(txtHeader);

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

            this.addObject(lbAirlineInfo);

            lbAirlineInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelUsedAirliner", "1002"), UICreator.CreateTextBlock(string.Format("{0} ({1} years old)", this.Airliner.BuiltDate.ToShortDateString(), this.Airliner.Age))));

            WrapPanel panelTailNumber = new WrapPanel();

            TextBlock txtTailNumber = UICreator.CreateTextBlock(this.Airliner.TailNumber);
            txtTailNumber.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            panelTailNumber.Children.Add(txtTailNumber);

            ContentControl ccFlag = new ContentControl();
            ccFlag.SetResourceReference(ContentControl.ContentTemplateProperty, "CountryFlagLongItem");
            ccFlag.Content = new CountryCurrentCountryConverter().Convert(Countries.GetCountryFromTailNumber(this.Airliner.TailNumber));
            ccFlag.Margin = new Thickness(10, 0, 0, 0);

            panelTailNumber.Children.Add(ccFlag);

            lbAirlineInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelUsedAirliner", "1003"), panelTailNumber));
            lbAirlineInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelUsedAirliner", "1004"), UICreator.CreateTextBlock(string.Format("{0:0.##} {1}", new NumberToUnitConverter().Convert(this.Airliner.Flown), new StringToLanguageConverter().Convert("km.")))));
            lbAirlineInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelUsedAirliner", "1005"), UICreator.CreateTextBlock(string.Format("{0:0.##} {1}", new NumberToUnitConverter().Convert(this.Airliner.LastServiceCheck),new StringToLanguageConverter().Convert("km.")))));

            foreach (AirlinerClass aClass in this.Airliner.Classes)
            {
                TextBlock txtClass = UICreator.CreateTextBlock(new TextUnderscoreConverter().Convert(aClass.Type, null, null, null).ToString());
                txtClass.FontWeight = FontWeights.Bold;

                lbAirlineInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelUsedAirliner", "1006"), txtClass));

                foreach (AirlinerFacility.FacilityType type in Enum.GetValues(typeof(AirlinerFacility.FacilityType)))
                {
                    AirlinerFacility facility = aClass.getFacility(type);
                    lbAirlineInfo.Items.Add(new QuickInfoValue(string.Format("{0} facilities", type), UICreator.CreateTextBlock(facility.Name)));
                }
            }

            TextBlock txtPriceHeader = new TextBlock();
            txtPriceHeader.Uid = "1101";
            txtPriceHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtPriceHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtPriceHeader.Margin = new System.Windows.Thickness(0, 5, 0, 0);
            txtPriceHeader.FontWeight = FontWeights.Bold;
            txtPriceHeader.Text = Translator.GetInstance().GetString("PanelUsedAirliner", txtPriceHeader.Uid);

            this.addObject(txtPriceHeader);

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

            this.addObject(lbPriceInfo);

            /*
            lbPriceInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelUsedAirliner", "1102"), UICreator.CreateTextBlock(string.Format("{0:c}", this.Airliner.Price))));
            lbPriceInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelUsedAirliner", "1103"), UICreator.CreateTextBlock(string.Format("{0:c}", this.Airliner.LeasingPrice))));
            lbPriceInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelUsedAirliner", "1104"), UICreator.CreateTextBlock(string.Format("{0:c}", this.Airliner.Type.getMaintenance()))));
            */

            lbPriceInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelUsedAirliner", "1102"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(Airliner.Price).ToString())));
            lbPriceInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelUsedAirliner", "1103"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airliner.LeasingPrice).ToString())));
            lbPriceInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelUsedAirliner", "1104"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airliner.Type.getMaintenance()).ToString())));

            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 && a.getMaxRunwayLength() >= this.Airliner.Type.MinRunwaylength);
            airports = (from a in airports orderby a.Profile.Name select a).ToList();
//.........这里部分代码省略.........
开发者ID:pedromorgan,项目名称:theairlineproject-cs,代码行数:101,代码来源:PanelUsedAirliner.cs

示例14: createWagesPanel

        //creates the wage panel
        private StackPanel createWagesPanel()
        {
            StackPanel panelWagesFee = new StackPanel();

            TextBlock txtHeaderFoods = new TextBlock();
            txtHeaderFoods.Uid = "1002";
            //txtHeaderFoods.Margin = new Thickness(0, 5, 0, 0);
            txtHeaderFoods.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeaderFoods.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeaderFoods.FontWeight = FontWeights.Bold;
            txtHeaderFoods.Text = Translator.GetInstance().GetString("PageAirlineWages", txtHeaderFoods.Uid);

            panelWagesFee.Children.Add(txtHeaderFoods);

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

            foreach (FeeType type in FeeTypes.GetTypes(FeeType.eFeeType.FoodDrinks))
                lbFoodDrinks.Items.Add(new QuickInfoValue(type.Name, createWageSlider(type)));

            panelWagesFee.Children.Add(lbFoodDrinks);

            TextBlock txtHeaderFees = new TextBlock();
            txtHeaderFees.Uid = "1003";
            txtHeaderFees.Margin = new Thickness(0, 5, 0, 0);
            txtHeaderFees.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeaderFees.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeaderFees.FontWeight = FontWeights.Bold;
            txtHeaderFees.Text = Translator.GetInstance().GetString("PageAirlineWages", txtHeaderFees.Uid);

            panelWagesFee.Children.Add(txtHeaderFees);

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

            foreach (FeeType type in FeeTypes.GetTypes(FeeType.eFeeType.Fee).FindAll(f=>f.FromYear<=GameObject.GetInstance().GameTime.Year))
                lbFees.Items.Add(new QuickInfoValue(type.Name, createWageSlider(type)));

            panelWagesFee.Children.Add(lbFees);

            TextBlock txtHeaderDiscounts = new TextBlock();
            txtHeaderDiscounts.Uid = "1015";
            txtHeaderDiscounts.Margin = new Thickness(0, 5, 0, 0);
            txtHeaderDiscounts.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeaderDiscounts.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeaderDiscounts.FontWeight = FontWeights.Bold;
            txtHeaderDiscounts.Text = Translator.GetInstance().GetString("PageAirlineWages",txtHeaderDiscounts.Uid);

            panelWagesFee.Children.Add(txtHeaderDiscounts);

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

            foreach (FeeType type in FeeTypes.GetTypes(FeeType.eFeeType.Discount).FindAll(f => f.FromYear <= GameObject.GetInstance().GameTime.Year))
                lbDiscounts.Items.Add(new QuickInfoValue(type.Name, createDiscountSlider(type)));

            panelWagesFee.Children.Add(lbDiscounts);

            panelWagesFee.Children.Add(createButtonsPanel());

            return panelWagesFee;
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:66,代码来源:PageAirlineWages.xaml.cs

示例15: createPoliciesPanel

        //creates the policies panel
        private StackPanel createPoliciesPanel()
        {
            StackPanel panelPolicies = new StackPanel();

            TextBlock txtHeaderPolicies = new TextBlock();
            txtHeaderPolicies.Uid = "1016";
            //txtHeaderFoods.Margin = new Thickness(0, 5, 0, 0);
            txtHeaderPolicies.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeaderPolicies.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeaderPolicies.FontWeight = FontWeights.Bold;
            txtHeaderPolicies.Text = Translator.GetInstance().GetString("PageAirlineWages", txtHeaderPolicies.Uid);

            panelPolicies.Children.Add(txtHeaderPolicies);

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

            cbCancellationPolicy = new ComboBox();
            cbCancellationPolicy.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbCancellationPolicy.Width = 200;
            cbCancellationPolicy.ItemStringFormat = "{0} " + Translator.GetInstance().GetString("PageAirlineWages","1018");

            for (int i = 120; i < 300; i += 15)
                cbCancellationPolicy.Items.Add(i);

            cbCancellationPolicy.SelectedItem = this.Airline.getAirlinePolicy("Cancellation Minutes").PolicyValue;

            lbPolicies.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineWages","1017"),cbCancellationPolicy));

            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.Click += new RoutedEventHandler(btnOkCancellation_Click);
            btnOk.Margin = new Thickness(0, 5, 0, 0);
            btnOk.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnOk.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");

            panelPolicies.Children.Add(btnOk);

            return panelPolicies;
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:47,代码来源:PageAirlineWages.xaml.cs


注:本文中的System.Windows.Controls.ListBox.SetResourceReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。