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


C# ComboBox.SetResourceReference方法代码示例

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


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

示例1: btnMoveAirliner_Click

        private void btnMoveAirliner_Click(object sender, RoutedEventArgs e)
        {
            var airliner = (FleetAirliner)((Button)sender).Tag;

            ComboBox cbAirlines = new ComboBox();
            cbAirlines.SetResourceReference(StyleProperty, "ComboBoxTransparentStyle");
            cbAirlines.ItemTemplate = Application.Current.Resources["AirlineItem"] as DataTemplate;
            cbAirlines.HorizontalAlignment = HorizontalAlignment.Left;
            cbAirlines.Width = 200;

            if (Airline.Airline.Subsidiaries.Count > 0)
                foreach (SubsidiaryAirline sAirline in Airline.Airline.Subsidiaries)
                    cbAirlines.Items.Add(sAirline);
            else
                cbAirlines.Items.Add(((SubsidiaryAirline)Airline.Airline).Airline);

            cbAirlines.SelectedIndex = 0;

            if (
                PopUpSingleElement.ShowPopUp(
                    Translator.GetInstance().GetString("PageAirlineFleet", "1016"),
                    cbAirlines) == PopUpSingleElement.ButtonSelected.OK && cbAirlines.SelectedItem != null)
            {
                var airline = cbAirlines.SelectedItem as Airline;

                Airline.moveAirliner(airliner, airline);
            }
        }
开发者ID:TheAirlineProject,项目名称:tap-desktop,代码行数:28,代码来源:PageAirlineFleet.xaml.cs

示例2: PopUpAirlinerFacility

        public PopUpAirlinerFacility(AirlinerClass airlinerClass, AirlinerFacility.FacilityType type)
        {
            InitializeComponent();

            this.AirlinerClass = airlinerClass;
            this.Type = type;

            this.Title = "Select " + type.ToString().ToLower();

            this.Width = 400;

            this.Height = 120;

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

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

            cbFacility = new ComboBox();
            cbFacility.ItemTemplate = this.Resources["AirlinerFacilityItem"] as DataTemplate;
            cbFacility.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");

            foreach (AirlinerFacility facility in AirlinerFacilities.GetFacilities(this.Type,GameObject.GetInstance().GameTime.Year))
                cbFacility.Items.Add(facility);

            cbFacility.SelectedItem = this.AirlinerClass.getFacility(this.Type);

            mainPanel.Children.Add(cbFacility);

            mainPanel.Children.Add(createButtonsPanel());

            this.Content = mainPanel;
               // int serviceLevel, double percentOfSeats, double pricePerSeat
        }
开发者ID:pedromorgan,项目名称:theairlineproject-cs,代码行数:34,代码来源:PopUpAirlinerFacility.xaml.cs

示例3: btnBuyAircraft_Click

        private void btnBuyAircraft_Click(object sender, RoutedEventArgs e)
        {
            ComboBox cbAircraft = new ComboBox();
            cbAircraft.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAircraft.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbAircraft.ItemTemplate = this.Resources["TrainingAircraftTypeItem"] as DataTemplate;
            cbAircraft.Width = 300;

            foreach (TrainingAircraftType type in TrainingAircraftTypes.GetAircraftTypes().FindAll(t => GeneralHelpers.GetInflationPrice(t.Price) < GameObject.GetInstance().HumanAirline.Money))
                cbAircraft.Items.Add(type);

            cbAircraft.SelectedIndex = 0;

            if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PageShowFlightSchool", "1014"), cbAircraft) == PopUpSingleElement.ButtonSelected.OK && cbAircraft.SelectedItem != null)
            {

                TrainingAircraftType aircraft = (TrainingAircraftType)cbAircraft.SelectedItem;
                double price = aircraft.Price;

                this.FlightSchool.addTrainingAircraft(new TrainingAircraft(aircraft, GameObject.GetInstance().GameTime, this.FlightSchool.FlightSchool));

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

                setHireStudentsStatus();

            }
        }
开发者ID:tehknox,项目名称:tap-desktop,代码行数:27,代码来源:PageShowFlightSchool.xaml.cs

示例4: 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

示例5: btnAddClass_Click

        private void btnAddClass_Click(object sender, RoutedEventArgs e)
        {
            ComboBox cbClasses = new ComboBox();
            cbClasses.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbClasses.ItemTemplate = this.Resources["AirlinerClassItem"] as DataTemplate;
            cbClasses.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbClasses.Width = 200;

            foreach (AirlinerClass.ClassType type in Enum.GetValues(typeof(AirlinerClass.ClassType)))
            {
                Boolean hasClass = this.Airliner.Classes.ToList().Exists(c => c.Type == type);
                if ((int)type <= GameObject.GetInstance().GameTime.Year && !hasClass)
                {
                    cbClasses.Items.Add(type);
                }
            }

            cbClasses.SelectedIndex = 0;

            AirlinerClassMVVM tClass = this.Airliner.Classes[0];

            if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PageFleetAirlinerInformation", "1011"), cbClasses) == PopUpSingleElement.ButtonSelected.OK && cbClasses.SelectedItem != null)
            {
                int maxseats;

                int maxCapacity;

                if (this.Airliner.Airliner.Airliner.Type.TypeAirliner == AirlinerType.TypeOfAirliner.Passenger)
                    maxCapacity = ((AirlinerPassengerType)this.Airliner.Airliner.Airliner.Type).MaxSeatingCapacity;
                else
                    maxCapacity = tClass.RegularSeatingCapacity;

                if (this.Airliner.Classes.Count == 2)
                    maxseats =maxCapacity - 1 - this.Airliner.Classes[1].RegularSeatingCapacity;
                else
                    maxseats = maxCapacity - 1;

                AirlinerClassMVVM aClass = new AirlinerClassMVVM(new AirlinerClass((AirlinerClass.ClassType)cbClasses.SelectedItem,0), 1, 1, maxseats, true);

                foreach (AirlinerFacilityMVVM aFacility in aClass.Facilities)
                {
                    var facility = AirlinerFacilities.GetBasicFacility(aFacility.Type);
                    aFacility.SelectedFacility = facility;
                }

                this.Airliner.Classes.Add(aClass);

                tClass.RegularSeatingCapacity -= aClass.RegularSeatingCapacity;

                tClass.Seating = Convert.ToInt16(Convert.ToDouble(tClass.RegularSeatingCapacity) / tClass.Facilities.Where(f => f.Type == AirlinerFacility.FacilityType.Seat).First().SelectedFacility.SeatUses);

            }
        }
开发者ID:tehknox,项目名称:tap-desktop,代码行数:53,代码来源:PageFleetAirlinerInformation.xaml.cs

示例6: PopUpNewAirlinerHomebase

        public PopUpNewAirlinerHomebase(FleetAirliner airliner)
        {
            this.Airliner = airliner;

            this.Title = string.Format("Select new homebase for {0}", airliner.Name);

            this.Width = 300;

            this.Height = 100;

            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;

            this.WindowStyle = WindowStyle.SingleBorderWindow;

            StackPanel mainPanel = new StackPanel();
            mainPanel.Margin = new Thickness(10, 10, 10, 10);
            cbAirport = new ComboBox();
            cbAirport.SetResourceReference(ComboBox.ItemTemplateProperty, "AirportCountryItem");
            cbAirport.SetResourceReference(StyleProperty, "ComboBoxTransparentStyle");
            cbAirport.IsSynchronizedWithCurrentItem = true;
            cbAirport.HorizontalAlignment = HorizontalAlignment.Left;

            List<Airport> airports = this.Airliner.Airliner.Airline.Airports.FindAll(a => (a.GetCurrentAirportFacility(this.Airliner.Airliner.Airline, AirportFacility.FacilityType.Service).TypeLevel > 0 || a.HasContractType(this.Airliner.Airliner.Airline,AirportContract.ContractType.FullService)) && a.Profile.Period.From <= GameObject.GetInstance().GameTime && a.Profile.Period.To > GameObject.GetInstance().GameTime);

            if (airports.Count == 0)
                airports = this.Airliner.Airliner.Airline.Airports.FindAll(a => a.Profile.Period.From <= GameObject.GetInstance().GameTime && a.Profile.Period.To > GameObject.GetInstance().GameTime);

            airports.Sort(delegate(Airport a1, Airport a2) { return a1.Profile.Name.CompareTo(a2.Profile.Name); });

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

            cbAirport.SelectedIndex = 0;

            mainPanel.Children.Add(cbAirport);

            mainPanel.Children.Add(createButtonsPanel());

            this.Content = mainPanel;
        }
开发者ID:TheAirlineProject,项目名称:tap-desktop,代码行数:40,代码来源:PopUpNewAirlinerHomebase.cs

示例7: btnBuild_Click

        private void btnBuild_Click(object sender, RoutedEventArgs e)
        {
            double price = GeneralHelpers.GetInflationPrice(267050);

            var cbAirport = new ComboBox();
            cbAirport.SetResourceReference(StyleProperty, "ComboBoxTransparentStyle");
            cbAirport.Width = 200;
            cbAirport.SelectedValuePath = "Profile.Town.Name";
            cbAirport.DisplayMemberPath = "Profile.Town.Name";
            cbAirport.HorizontalAlignment = HorizontalAlignment.Left;

            List<Airport> homeAirports =
                GameObject.GetInstance()
                    .HumanAirline.Airports.FindAll(
                        a =>
                            a.GetCurrentAirportFacility(
                                GameObject.GetInstance().HumanAirline,
                                AirportFacility.FacilityType.Service).TypeLevel > 0);
            homeAirports.AddRange(GameObject.GetInstance().HumanAirline.Airports.FindAll(a => a.IsHub)); //hubs
            homeAirports = homeAirports.Distinct().ToList();

            foreach (Airport airport in homeAirports)
            {
                if (GameObject.GetInstance().HumanAirline.FlightSchools.Find(f => f.Airport == airport) == null)
                {
                    cbAirport.Items.Add(airport);
                }
            }

            cbAirport.SelectedIndex = 0;

            if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PagePilots", "1004"), cbAirport)
                == PopUpSingleElement.ButtonSelected.OK && cbAirport.SelectedItem != null)
            {
                var airport = (Airport)cbAirport.SelectedItem;

                var fs = new FlightSchool(airport);

                GameObject.GetInstance().HumanAirline.AddFlightSchool(fs);
                FlightSchools.Add(fs);

                AirlineHelpers.AddAirlineInvoice(
                    GameObject.GetInstance().HumanAirline,
                    GameObject.GetInstance().GameTime,
                    Invoice.InvoiceType.AirlineExpenses,
                    -price);

                ICollectionView view = CollectionViewSource.GetDefaultView(lvInstructors.ItemsSource);
                view.Refresh();
            }
        }
开发者ID:TheAirlineProject,项目名称:tap-desktop,代码行数:51,代码来源:PageFlightSchools.xaml.cs

示例8: PopUpHomeBase

        public PopUpHomeBase(FleetAirliner airliner)
        {
            this.Airliner = airliner;

            this.Title = "Select New Homebase";

            this.Width = 300;

            this.Height = 100;

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

            this.WindowStyle = System.Windows.WindowStyle.None;

            StackPanel mainPanel = new StackPanel();
            mainPanel.Margin = new Thickness(10, 10, 10, 10);
            cbAirport = new ComboBox();
            cbAirport.SetResourceReference(ComboBox.ItemTemplateProperty, "AirportCountryItem");
            cbAirport.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAirport.IsSynchronizedWithCurrentItem = true;
            cbAirport.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

            List<Airport> airports = this.Airliner.Airliner.Airline.Airports.FindAll((delegate(Airport airport) { return airport.getCurrentAirportFacility(this.Airliner.Airliner.Airline,AirportFacility.FacilityType.Service).TypeLevel>0; }));
            airports.Sort(delegate(Airport a1, Airport a2) { return a1.Profile.Name.CompareTo(a2.Profile.Name); });

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

            cbAirport.SelectedItem = this.Airliner.Homebase;

            mainPanel.Children.Add(cbAirport);

            mainPanel.Children.Add(createButtonsPanel());

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

示例9: PopUpAirportSlot

        public PopUpAirportSlot(Airport airport)
        {
            this.Airport = airport;

            InitializeComponent();

            this.Title = this.Airport.Profile.Name;

            this.Width = 800;

            this.Height = 400;

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

            StackPanel panelMain = new StackPanel();

            WrapPanel panelDay = new WrapPanel();

            TextBlock txtDay = UICreator.CreateTextBlock("Day: ");
            //txtDay.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            txtDay.FontWeight = FontWeights.Bold;

            panelDay.Children.Add(txtDay);

            ComboBox cbDay = new ComboBox();
            cbDay.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbDay.Width = 100;
            cbDay.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            cbDay.Margin = new Thickness(0, 0, 0, 10);
            cbDay.SelectionChanged += new SelectionChangedEventHandler(cbDay_SelectionChanged);
            cbDay.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

            foreach (DayOfWeek day in Enum.GetValues(typeof(DayOfWeek)))
                cbDay.Items.Add(day);

            panelDay.Children.Add(cbDay);

            panelMain.Children.Add(panelDay);

            panelSlot = new StackPanel();
            panelMain.Children.Add(panelSlot);

            cbDay.SelectedIndex = 0;

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

示例10: btnHire_Click

        private void btnHire_Click(object sender, RoutedEventArgs e)
        {
            var pilot = (Pilot)((Button)sender).Tag;

            WPFMessageBoxResult result = WPFMessageBox.Show(
                Translator.GetInstance().GetString("MessageBox", "2801"),
                Translator.GetInstance().GetString("MessageBox", "2801", "message"),
                WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                GameObject.GetInstance().HumanAirline.AddPilot(pilot);

                AllPilots.Remove(pilot);

                IEnumerable<FleetAirliner> fleetMissingPilots =
                    GameObject.GetInstance().HumanAirline.Fleet.Where(f => f.Pilots.Count < f.Airliner.Type.CockpitCrew && pilot.Aircrafts.Exists(a=>f.Airliner.Type.AirlinerFamily == a));

                if (fleetMissingPilots.Count() > 0)
                {
                    var cbAirliners = new ComboBox();
                    cbAirliners.SetResourceReference(StyleProperty, "ComboBoxTransparentStyle");
                    cbAirliners.Width = 200;
                    cbAirliners.HorizontalAlignment = HorizontalAlignment.Left;
                    cbAirliners.ItemTemplate = Resources["pilotAirlinerItem"] as DataTemplate;

                    foreach (FleetAirliner airliner in fleetMissingPilots)
                    {
                        cbAirliners.Items.Add(airliner);
                    }

                    cbAirliners.SelectedIndex = 0;

                    if (PopUpSingleElement.ShowPopUp(
                        Translator.GetInstance().GetString("PagePilots", "1010"),
                        cbAirliners) == PopUpSingleElement.ButtonSelected.OK && cbAirliners.SelectedItem != null)
                    {
                        var airliner = (FleetAirliner)cbAirliners.SelectedItem;

                        airliner.AddPilot(pilot);
                    }
                }
            }
        }
开发者ID:TheAirlineProject,项目名称:tap-desktop,代码行数:44,代码来源:PagePilots.xaml.cs

示例11: btnHire_Click

        private void btnHire_Click(object sender, RoutedEventArgs e)
        {
            Pilot pilot = (Pilot)((Button)sender).Tag;

            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2801"), Translator.GetInstance().GetString("MessageBox", "2801", "message"), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                GameObject.GetInstance().HumanAirline.addPilot(pilot);

                this.AllPilots.Remove(pilot);

                var fleetMissingPilots = GameObject.GetInstance().HumanAirline.Fleet.Where(f=>f.Pilots.Count < f.Airliner.Type.CockpitCrew);

                if (fleetMissingPilots.Count() > 0)
                {
                    ComboBox cbAirliners = new ComboBox();
                    cbAirliners.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
                    cbAirliners.Width = 200;
                    cbAirliners.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    cbAirliners.DisplayMemberPath = "Name";
                    cbAirliners.SelectedValuePath = "Name";

                    foreach (FleetAirliner airliner in fleetMissingPilots)
                        cbAirliners.Items.Add(airliner);

                    cbAirliners.SelectedIndex = 0;

                    if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PagePilots", "1010"), cbAirliners) == PopUpSingleElement.ButtonSelected.OK && cbAirliners.SelectedItem != null)
                    {
                        FleetAirliner airliner = (FleetAirliner)cbAirliners.SelectedItem;

                        airliner.addPilot(pilot);
                    }
                }
            }
        }
开发者ID:tehknox,项目名称:tap-desktop,代码行数:37,代码来源:PagePilots.xaml.cs

示例12: createTransferFundsPanel

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

示例13: createHumanControllingPanel

        //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;
        }
开发者ID:pedromorgan,项目名称:theairlineproject-cs,代码行数:48,代码来源:PageAirline.xaml.cs

示例14: 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

示例15: btnEditOwner_Click

        private void btnEditOwner_Click(object sender, RoutedEventArgs e)
        {
            ComboBox cbAirlines = new ComboBox();
            cbAirlines.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAirlines.SetResourceReference(ComboBox.ItemTemplateProperty, "AirlineLogoItem");
            cbAirlines.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbAirlines.Width = 200;

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

            foreach (SubsidiaryAirline airline in GameObject.GetInstance().MainAirline.Subsidiaries)
                cbAirlines.Items.Add(airline);

            cbAirlines.Items.Remove(this.Airliner.Airliner.Airline);

            cbAirlines.SelectedIndex = 0;

            if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PageFleetAirliner", "1028"), cbAirlines) == PopUpSingleElement.ButtonSelected.OK && cbAirlines.SelectedItem != null)
            {
                Airline airline = (Airline)cbAirlines.SelectedItem;

                this.Airliner.Airliner.Airline.removeAirliner(this.Airliner);
                airline.addAirliner(this.Airliner);
                this.Airliner.Airliner.Airline = airline;

                PageNavigator.NavigateTo(new PageFleetAirliner(this.Airliner));
            }
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:28,代码来源:PageFleetAirliner.xaml.cs


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