Пример #1
0
        private void btnCredits_Click(object sender, RoutedEventArgs e)
        {
            StackPanel panelCredits = new StackPanel();

            Image imgCredits = new Image();

            imgCredits.Source = new BitmapImage(new Uri(AppSettings.getDataPath() + "\\graphics\\credits.png", UriKind.RelativeOrAbsolute));
            imgCredits.Height = GraphicsHelpers.GetContentHeight() - 50;
            RenderOptions.SetBitmapScalingMode(imgCredits, BitmapScalingMode.HighQuality);
            panelCredits.Children.Add(imgCredits);

            Button btnOk = new Button();

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

            btnOk.Click += btnOk_Click;

            panelCredits.Children.Add(btnOk);


            base.setContent(panelCredits);
        }
Пример #2
0
        //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);
        }
        public PageAirportDistances(Airport airport)
        {
            this.Airport = airport;

            InitializeComponent();

            StackPanel panelAirports = new StackPanel();

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

            ContentControl lblHeader = new ContentControl();

            lblHeader.ContentTemplate = this.Resources["AirportsHeader"] as DataTemplate;
            panelAirports.Children.Add(lblHeader);

            ListBox lbAirport = new ListBox();

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

            var airports = GameObject.GetInstance().HumanAirline.Airports.FindAll(a => a != this.Airport).OrderBy(a => MathHelpers.GetDistance(a, this.Airport));


            foreach (Airport destAirport in airports)
            {
                lbAirport.Items.Add(new KeyValuePair <Airport, Airport>(this.Airport, destAirport));
            }

            panelAirports.Children.Add(lbAirport);

            this.Content = panelAirports;
        }
        //creates the training aircrafts panel
        private StackPanel createTrainingAircraftsPanel()
        {
            StackPanel panelAircrafts = new StackPanel();

            panelAircrafts.Margin = new Thickness(0, 5, 0, 0);

            TextBlock txtHeader = new TextBlock();

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

            panelAircrafts.Children.Add(txtHeader);

            lbTrainingAircrafts = new ListBox();
            lbTrainingAircrafts.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbTrainingAircrafts.ItemTemplate = this.Resources["TrainingAircraftItem"] as DataTemplate;
            lbTrainingAircrafts.MaxHeight    = (GraphicsHelpers.GetContentHeight() - 100) / 6;

            panelAircrafts.Children.Add(lbTrainingAircrafts);

            return(panelAircrafts);
        }
Пример #5
0
        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;
        }
Пример #6
0
        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);
        }
Пример #7
0
        //creates the panel for arrivals
        private ScrollViewer createArrivalsPanel()
        {
            ScrollViewer svArrivals = new ScrollViewer();

            svArrivals.Margin = new Thickness(0, 10, 0, 0);
            svArrivals.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            svArrivals.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            svArrivals.MaxHeight = GraphicsHelpers.GetContentHeight() / 3;

            StackPanel panelArrivals = new StackPanel();

            panelArrivals.Margin = new Thickness(0, 10, 0, 0);

            Grid grdType = UICreator.CreateGrid(2);

            grdType.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            panelArrivals.Children.Add(grdType);

            Image imgLogo = new Image();

            imgLogo.Source = new BitmapImage(new Uri(@"/Data/images/Arrivals.png", UriKind.RelativeOrAbsolute));
            imgLogo.Height = 20;
            RenderOptions.SetBitmapScalingMode(imgLogo, BitmapScalingMode.HighQuality);

            Grid.SetColumn(imgLogo, 0);
            grdType.Children.Add(imgLogo);

            TextBlock txtType = UICreator.CreateTextBlock(Translator.GetInstance().GetString("PageAirport", "1002"));

            txtType.FontStyle = FontStyles.Oblique;
            txtType.FontSize  = 16;

            Grid.SetColumn(txtType, 1);
            grdType.Children.Add(txtType);

            ContentControl txtHeader = new ContentControl();

            txtHeader.Uid                 = "1003";
            txtHeader.ContentTemplate     = this.Resources["FlightHeader"] as DataTemplate;
            txtHeader.Content             = Translator.GetInstance().GetString("PageAirport", txtHeader.Uid);
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            panelArrivals.Children.Add(txtHeader);

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

            panelArrivals.Children.Add(lbArrivals);

            svArrivals.Content = panelArrivals;

            return(svArrivals);
        }
        //creates the overview of the fleet
        private StackPanel createOverviewPanel()
        {
            StackPanel panelOverview = new StackPanel();

            TextBlock txtFleetBoughtHeader = new TextBlock();

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

            panelOverview.Children.Add(txtFleetBoughtHeader);

            lvBoughtFleet            = new ListView();
            lvBoughtFleet.Background = Brushes.Transparent;
            lvBoughtFleet.SetResourceReference(ListView.ItemContainerStyleProperty, "ListViewItemStyle");
            lvBoughtFleet.MaxHeight = (GraphicsHelpers.GetContentHeight() - 100) / 2;
            lvBoughtFleet.AddHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(FleetHeaderClickedHandler), true);
            lvBoughtFleet.BorderThickness = new Thickness(0);
            lvBoughtFleet.View            = this.Resources["FleetViewBoughtItem"] as GridView;

            panelOverview.Children.Add(lvBoughtFleet);

            lvBoughtFleet.ItemsSource = this.FleetDelivered.Where(f => f.Purchased == FleetAirliner.PurchasedType.Bought || f.Purchased == FleetAirliner.PurchasedType.BoughtDownPayment);

            TextBlock txtFleetLeasedHeader = new TextBlock();

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

            panelOverview.Children.Add(txtFleetLeasedHeader);

            lvLeasedFleet            = new ListView();
            lvLeasedFleet.Background = Brushes.Transparent;
            lvLeasedFleet.SetResourceReference(ListView.ItemContainerStyleProperty, "ListViewItemStyle");
            lvLeasedFleet.MaxHeight = (GraphicsHelpers.GetContentHeight() - 100) / 2;
            lvLeasedFleet.AddHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(FleetHeaderClickedHandler), true);
            lvLeasedFleet.View = this.Resources["FleetViewLeasedItem"] as GridView;

            panelOverview.Children.Add(lvLeasedFleet);

            lvLeasedFleet.ItemsSource = this.FleetDelivered.Where(f => f.Purchased == FleetAirliner.PurchasedType.Leased);

            return(panelOverview);
        }
        //creates the panel for leased airliner
        private ScrollViewer createLeasedAirlinerPanel()
        {
            ScrollViewer scroller = new ScrollViewer();

            scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroller.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            scroller.MaxHeight = GraphicsHelpers.GetContentHeight() / 5;

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

            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", "1029");

            panelLeasedAirliner.Children.Add(txtHeader);

            ListBox lbQuickInfo = new ListBox();

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

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageFleetAirliner", "1025"), UICreator.CreateTextBlock(this.Airliner.PurchasedDate.ToShortDateString())));
            // lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageFleetAirliner", "1026"), UICreator.CreateTextBlock(string.Format("{0:C}", this.Airliner.Airliner.getPrice()))));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageFleetAirliner", "1026"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airliner.Airliner.getPrice()).ToString())));

            panelLeasedAirliner.Children.Add(lbQuickInfo);

            Button btnBuy = new Button();

            btnBuy.Uid = "200";
            btnBuy.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnBuy.Height  = Double.NaN;
            btnBuy.Width   = Double.NaN;
            btnBuy.Margin  = new Thickness(0, 5, 0, 0);
            btnBuy.Content = Translator.GetInstance().GetString("PageFleetAirliner", btnBuy.Uid);
            btnBuy.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnBuy.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnBuy.Click += new System.Windows.RoutedEventHandler(btnBuy_Click);
            panelLeasedAirliner.Children.Add(btnBuy);

            scroller.Content = panelLeasedAirliner;

            return(scroller);
        }
Пример #10
0
        public PanelAirliner(PageAirliners parent)
        {
            this.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            this.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            this.Height = GraphicsHelpers.GetContentHeight() - 100;

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

            this.Content = panelAirliner;

            this.ParentPage = parent;

            this.Margin = new Thickness(0, 0, 50, 0);
        }
Пример #11
0
        //creates the panel for the routes
        private StackPanel createRoutesPanel()
        {
            StackPanel routesPanel = new StackPanel();

            lbRoutes           = new ListBox();
            lbRoutes.MaxHeight = GraphicsHelpers.GetContentHeight() / 2;
            lbRoutes.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbRoutes.ItemTemplate = this.Resources["RouteItem"] as DataTemplate;
            lbRoutes.ItemsSource  = GameObject.GetInstance().HumanAirline.Routes;

            routesPanel.Children.Add(lbRoutes);



            return(routesPanel);
        }
Пример #12
0
        //creates the panel for the passengers
        private StackPanel createPassengersPanel()
        {
            StackPanel panelPassengers = new StackPanel();

            panelPassengers.Margin = new Thickness(0, 10, 0, 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("PageAirport", txtHeader.Uid);
            panelPassengers.Children.Add(txtHeader);

            WrapPanel panelButtons = new WrapPanel();

            ucSelectButton sbDomestic = new ucSelectButton();

            sbDomestic.Uid        = "1025";
            sbDomestic.Content    = Translator.GetInstance().GetString("PageAirport", sbDomestic.Uid);
            sbDomestic.IsSelected = true;
            sbDomestic.Click     += sbDomestic_Click;
            panelButtons.Children.Add(sbDomestic);

            ucSelectButton sbInternational = new ucSelectButton();

            sbInternational.Uid     = "1026";
            sbInternational.Content = Translator.GetInstance().GetString("PageAirport", sbInternational.Uid);
            sbInternational.Click  += sbInternational_Click;
            panelButtons.Children.Add(sbInternational);

            panelPassengers.Children.Add(panelButtons);

            lbPassengers = new ListBox();
            lbPassengers.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbPassengers.ItemTemplate = this.Resources["DemandItem"] as DataTemplate;
            lbPassengers.MaxHeight    = (GraphicsHelpers.GetContentHeight() - 100) / 3;
            panelPassengers.Children.Add(lbPassengers);

            domesticDemand = true;

            showDemand();

            return(panelPassengers);
        }
Пример #13
0
        //creates the for the panel advertisement
        private StackPanel createAdvertisementPanel()
        {
            cbAdvertisements = new Dictionary <AdvertisementType.AirlineAdvertisementType, ComboBox>();

            StackPanel panelAdvertisement = new StackPanel();

            TextBlock txtHeaderAdvertisement = new TextBlock();

            txtHeaderAdvertisement.Uid = "1003";
            txtHeaderAdvertisement.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeaderAdvertisement.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeaderAdvertisement.FontWeight = FontWeights.Bold;
            txtHeaderAdvertisement.Text       = Translator.GetInstance().GetString("PageAirlineFacilities", txtHeaderAdvertisement.Uid);
            panelAdvertisement.Children.Add(txtHeaderAdvertisement);

            lbAdvertisement = new ListBox();
            lbAdvertisement.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbAdvertisement.MaxHeight = (GraphicsHelpers.GetContentHeight() - 100) / 3;
            lbAdvertisement.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            panelAdvertisement.Children.Add(lbAdvertisement);

            // chs, 2011-17-10 changed so it is only advertisement types which has been invented which are shown
            foreach (AdvertisementType.AirlineAdvertisementType type in Enum.GetValues(typeof(AdvertisementType.AirlineAdvertisementType)))
            {
                if (GameObject.GetInstance().GameTime.Year >= (int)type)
                {
                    lbAdvertisement.Items.Add(new QuickInfoValue(type.ToString(), createAdvertisementTypeItem(type)));
                }
            }

            Button btnSave = new Button();

            btnSave.Uid = "113";
            btnSave.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnSave.Height = 16;
            btnSave.Width  = Double.NaN;
            btnSave.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnSave.Margin  = new Thickness(0, 5, 0, 0);
            btnSave.Content = Translator.GetInstance().GetString("General", btnSave.Uid);
            btnSave.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnSave.Click     += new RoutedEventHandler(btnSaveAdvertisement_Click);
            btnSave.Visibility = this.Airline.IsHuman ? Visibility.Visible : System.Windows.Visibility.Collapsed;

            panelAdvertisement.Children.Add(btnSave);

            return(panelAdvertisement);
        }
        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();
        }
        //creates the panel for flights
        private StackPanel createFlightsPanel()
        {
            StackPanel panelFlights = new StackPanel();

            panelFlights.Margin = new Thickness(0, 20, 0, 0);

            WrapPanel panelButtons = new WrapPanel();

            ucSelectButton sbArrivals = new ucSelectButton();

            sbArrivals.Uid        = "1029";
            sbArrivals.Content    = Translator.GetInstance().GetString("PageAirport", sbArrivals.Uid);
            sbArrivals.IsSelected = true;
            sbArrivals.Click     += sbArrivals_Click;
            panelButtons.Children.Add(sbArrivals);

            ucSelectButton sbDepartures = new ucSelectButton();

            sbDepartures.Uid     = "1030";
            sbDepartures.Content = Translator.GetInstance().GetString("PageAirport", sbDepartures.Uid);
            sbDepartures.Click  += sbDepartures_Click;
            panelButtons.Children.Add(sbDepartures);

            panelFlights.Children.Add(panelButtons);

            ContentControl ccHeader = new ContentControl();

            ccHeader.ContentTemplate = this.Resources["FlightHeader"] as DataTemplate;
            panelFlights.Children.Add(ccHeader);

            lbFlights = new ListBox();
            lbFlights.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbFlights.ItemTemplate = this.Resources["FlightItem"] as DataTemplate;
            lbFlights.MaxHeight    = (GraphicsHelpers.GetContentHeight() - 100) / 2;
            panelFlights.Children.Add(lbFlights);

            showFlights(true);


            return(panelFlights);
        }
Пример #16
0
        //creates the panel for the airline services
        private StackPanel createAirlineServicesPanel()
        {
            StackPanel panelFacilities = new StackPanel();

            TextBlock txtHeaderFacilities = new TextBlock();

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

            lbFacilities = new ListBox();
            lbFacilities.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbFacilities.ItemTemplate = this.Resources["FacilityItem"] as DataTemplate;
            lbFacilities.MaxHeight    = (GraphicsHelpers.GetContentHeight() - 100) / 2;
            panelFacilities.Children.Add(lbFacilities);

            TextBlock txtNewAirlineFacilities = new TextBlock();

            txtNewAirlineFacilities.Uid = "1002";
            txtNewAirlineFacilities.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtNewAirlineFacilities.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtNewAirlineFacilities.FontWeight = FontWeights.Bold;
            txtNewAirlineFacilities.Text       = Translator.GetInstance().GetString("PageAirlineFacilities", txtNewAirlineFacilities.Uid);
            txtNewAirlineFacilities.Margin     = new Thickness(0, 5, 0, 0);
            txtNewAirlineFacilities.Visibility = this.Airline.IsHuman ? Visibility.Visible : System.Windows.Visibility.Collapsed;
            panelFacilities.Children.Add(txtNewAirlineFacilities);

            lbNewFacilities = new ListBox();
            lbNewFacilities.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbNewFacilities.ItemTemplate = this.Resources["FacilityNewItem"] as DataTemplate;
            lbNewFacilities.MaxHeight    = (GraphicsHelpers.GetContentHeight() - 100) / 2;
            panelFacilities.Children.Add(lbNewFacilities);

            lbNewFacilities.Visibility = this.Airline.IsHuman ? Visibility.Visible : Visibility.Collapsed;

            return(panelFacilities);
        }
Пример #17
0
        public PageAirportStatistics(Airport airport)
        {
            InitializeComponent();

            this.Airport = airport;

            ScrollViewer svStatistics = new ScrollViewer();

            svStatistics.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            svStatistics.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            svStatistics.MaxHeight = GraphicsHelpers.GetContentHeight() - 50;

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

            panelStatistics.Children.Add(txtHeader);

            panelStats = new StackPanel();

            panelStatistics.Children.Add(panelStats);

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

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

            svStatistics.Content = panelStatistics;

            this.Content = svStatistics;

            showStats();
        }
Пример #18
0
        //creates the fleet panel
        private StackPanel createFleetPanel()
        {
            StackPanel panelFleet = new StackPanel();

            panelFleet.Margin = new Thickness(0, 10, 0, 0);

            ContentControl txtFleetHeader = new ContentControl();

            txtFleetHeader.ContentTemplate     = this.Resources["FleetHeader"] as DataTemplate;
            txtFleetHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            panelFleet.Children.Add(txtFleetHeader);

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

            panelFleet.Children.Add(lbFleet);

            return(panelFleet);
        }
        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();
        }
Пример #20
0
        public PageAirportFacilities(Airport airport)
        {
            InitializeComponent();

            this.Language = XmlLanguage.GetLanguage(new CultureInfo(AppSettings.GetInstance().getLanguage().CultureInfo, true).IetfLanguageTag);

            this.Airport = airport;

            ScrollViewer svFacilities = new ScrollViewer();

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

            panelFacilities = new StackPanel();

            svFacilities.Content = panelFacilities;

            showFacilitiesInformation();

            this.Content = svFacilities;
        }
Пример #21
0
        //creates the inflight services panel
        private ScrollViewer createInflightServicesPanel()
        {
            this.Facilities   = new Dictionary <AirlinerClass.ClassType, List <RouteFacility> >();
            this.cbFacilities = new Dictionary <AirlinerClass.ClassType, List <ComboBox> >();

            ScrollViewer scroller = new ScrollViewer();

            scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroller.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            scroller.MaxHeight = GraphicsHelpers.GetContentHeight() - 100;


            StackPanel panelServices = new StackPanel();

            /*
             * TextBlock txtServicesHeader = new TextBlock();
             * txtServicesHeader.Uid = "1007";
             * txtServicesHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
             * txtServicesHeader.FontWeight = FontWeights.Bold;
             * txtServicesHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
             * txtServicesHeader.Text = Translator.GetInstance().GetString("PageAirlineWages", txtServicesHeader.Uid);
             *
             * panelServices.Children.Add(txtServicesHeader);
             */
            foreach (AirlinerClass.ClassType classType in Enum.GetValues(typeof(AirlinerClass.ClassType)))
            {
                this.cbFacilities.Add(classType, new List <ComboBox>());

                TextBlock txtClassHeader = new TextBlock();
                txtClassHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                txtClassHeader.FontWeight          = FontWeights.Bold;
                txtClassHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
                txtClassHeader.Text   = new TextUnderscoreConverter().Convert(classType).ToString();
                txtClassHeader.Margin = new Thickness(0, 5, 0, 0);

                panelServices.Children.Add(txtClassHeader);

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

                panelServices.Children.Add(lbServices);

                foreach (RouteFacility.FacilityType facilityType in Enum.GetValues(typeof(RouteFacility.FacilityType)))
                {
                    if (GameObject.GetInstance().GameTime.Year >= (int)facilityType)
                    {
                        ComboBox cbFacility = new ComboBox();
                        cbFacility.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
                        cbFacility.Width             = 200;
                        cbFacility.DisplayMemberPath = "Name";
                        cbFacility.SelectedValuePath = "Name";
                        cbFacility.Tag = classType;
                        cbFacility.SelectionChanged += new SelectionChangedEventHandler(cbFacility_SelectionChanged);

                        AirlineHelpers.GetRouteFacilities(GameObject.GetInstance().HumanAirline, facilityType).ForEach(f => cbFacility.Items.Add(f));

                        lbServices.Items.Add(new QuickInfoValue(new TextUnderscoreConverter().Convert(facilityType).ToString(), cbFacility));

                        cbFacility.SelectedIndex = 0;

                        this.cbFacilities[classType].Add(cbFacility);
                    }
                }
            }

            WrapPanel panelButtons = new WrapPanel();

            panelButtons.Margin = new Thickness(0, 5, 0, 0);

            panelServices.Children.Add(panelButtons);

            Button btnSave = new Button();

            btnSave.Uid = "113";
            btnSave.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnSave.Height  = Double.NaN;
            btnSave.Width   = Double.NaN;
            btnSave.Content = Translator.GetInstance().GetString("General", btnSave.Uid);
            btnSave.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnSave.Click += new RoutedEventHandler(btnSave_Click);
            panelButtons.Children.Add(btnSave);

            Button btnLoad = new Button();

            btnLoad.Uid = "114";
            btnLoad.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnLoad.Height  = Double.NaN;
            btnLoad.Width   = Double.NaN;
            btnLoad.Content = Translator.GetInstance().GetString("General", btnLoad.Uid);
            btnLoad.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnLoad.Click += new RoutedEventHandler(btnLoad_Click);
            panelButtons.Children.Add(btnLoad);


            scroller.Content = panelServices;

            return(scroller);
        }
Пример #22
0
        public PagePilots()
        {
            InitializeComponent();

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

            StackPanel pilotsPanel = new StackPanel();

            pilotsPanel.Margin = new Thickness(10, 0, 10, 0);

            StandardContentPanel panelContent = new StandardContentPanel();

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

            TextBlock txtPilotsHeader = new TextBlock();

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

            pilotsPanel.Children.Add(txtPilotsHeader);

            ContentControl ccPilotsHeader = new ContentControl();

            ccPilotsHeader.ContentTemplate     = this.Resources["PilotsHeader"] as DataTemplate;
            ccPilotsHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            pilotsPanel.Children.Add(ccPilotsHeader);

            lbPilots = new ListBox();
            lbPilots.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbPilots.ItemTemplate = this.Resources["PilotItem"] as DataTemplate;
            lbPilots.MaxHeight    = (GraphicsHelpers.GetContentHeight() - 200) / 3;

            pilotsPanel.Children.Add(lbPilots);

            TextBlock txtInstructorsHeader = new TextBlock();

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

            pilotsPanel.Children.Add(txtInstructorsHeader);


            ContentControl ccInstructorsHeader = new ContentControl();

            ccInstructorsHeader.ContentTemplate     = this.Resources["InstructorsHeader"] as DataTemplate;
            ccInstructorsHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            pilotsPanel.Children.Add(ccInstructorsHeader);

            lbInstructors = new ListBox();
            lbInstructors.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbInstructors.ItemTemplate = this.Resources["InstructorItem"] as DataTemplate;
            lbInstructors.MaxHeight    = (GraphicsHelpers.GetContentHeight() - 200) / 3;

            pilotsPanel.Children.Add(lbInstructors);

            TextBlock txtFlightSchoolsHeader = new TextBlock();

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

            pilotsPanel.Children.Add(txtFlightSchoolsHeader);

            ContentControl ccFlightSchoolHeader = new ContentControl();

            ccFlightSchoolHeader.ContentTemplate     = this.Resources["FlightSchoolsHeader"] as DataTemplate;
            ccFlightSchoolHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            pilotsPanel.Children.Add(ccFlightSchoolHeader);

            lbFlightSchools = new ListBox();
            lbFlightSchools.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbFlightSchools.ItemTemplate = this.Resources["FlightSchoolItem"] as DataTemplate;
            lbFlightSchools.MaxHeight    = (GraphicsHelpers.GetContentHeight() - 200) / 3;

            pilotsPanel.Children.Add(lbFlightSchools);

            WrapPanel buttonsPanel = new WrapPanel();

            buttonsPanel.Margin = new Thickness(0, 5, 0, 0);

            btnBuild     = new Button();
            btnBuild.Uid = "200";
            btnBuild.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnBuild.Height  = Double.NaN;
            btnBuild.Width   = Double.NaN;
            btnBuild.Content = Translator.GetInstance().GetString("PagePilots", btnBuild.Uid);
            btnBuild.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnBuild.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnBuild.Click += new RoutedEventHandler(btnBuild_Click);

            buttonsPanel.Children.Add(btnBuild);

            pilotsPanel.Children.Add(buttonsPanel);

            panelSideMenu = new Frame();

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

            base.setContent(panelContent);

            base.setHeaderContent(this.Title);

            showPage(this);

            showPilots();

            showFlightSchools();

            showInstructors();
        }
        //creates the panel for some routes information
        private StackPanel createRoutesInformationPanel()
        {
            StackPanel informationPanel = new StackPanel();

            informationPanel.Margin = new Thickness(0, 10, 0, 0);

            TextBlock txtHeader = new TextBlock();

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

            informationPanel.Children.Add(txtHeader);

            ListBox lbInfo = new ListBox();

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

            informationPanel.Children.Add(lbInfo);

            lbInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineDestinations", "1004"), UICreator.CreateTextBlock(this.Airline.Routes.Count.ToString())));

            Route maxDistanceRoute = this.Airline.Routes.Count > 0 ? (from r in this.Airline.Routes orderby MathHelpers.GetDistance(r.Destination1, r.Destination2) descending select r).First() : null;

            if (maxDistanceRoute != null)
            {
                lbInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineDestinations", "1005"), UICreator.CreateTextBlock(string.Format("{0:0} {1} ({2}<->{3})", new NumberToUnitConverter().Convert(MathHelpers.GetDistance(maxDistanceRoute.Destination1, maxDistanceRoute.Destination2)), new StringToLanguageConverter().Convert("km."), new AirportCodeConverter().Convert(maxDistanceRoute.Destination1).ToString(), new AirportCodeConverter().Convert(maxDistanceRoute.Destination2).ToString()))));
            }

            double avgBalance = this.Airline.Routes.Count == 0 ? 0 : this.Airline.Routes.Average(r => r.Balance);
            //lbInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineDestinations", "1006"), UICreator.CreateTextBlock(string.Format("{0:C}", avgBalance))));
            TextBlock txtAvgBalance = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(avgBalance).ToString());

            txtAvgBalance.Foreground = new ValueIsMinusConverter().Convert(avgBalance) as SolidColorBrush;

            lbInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineDestinations", "1006"), txtAvgBalance));

            var airlinePassengerRoutes = this.Airline.Routes.Where(r => r.Type == Route.RouteType.Passenger || r.Type == Route.RouteType.Mixed);

            double avgFillingPercent = this.Airline.Routes.Count == 0 || airlinePassengerRoutes.Count() == 0 ? 0 : airlinePassengerRoutes.Average(r => ((PassengerRoute)r).FillingDegree);

            lbInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineDestinations", "1007"), UICreator.CreateTextBlock(string.Format("{0:0} %", avgFillingPercent * 100))));

            int totalFlights = this.Airline.Routes.Count == 0 ? 0 : this.Airline.Routes.Sum(r => r.TimeTable.Entries.Count);

            lbInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineDestinations", "1008"), UICreator.CreateTextBlock(totalFlights.ToString())));

            long totalPassengers = this.Airline.Routes.Count == 0 ? 0 : this.Airline.Routes.Sum(r => r.Statistics.getTotalValue(StatisticsTypes.GetStatisticsType("Passengers")));

            lbInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineDestinations", "1009"), UICreator.CreateTextBlock(totalPassengers.ToString())));

            Airport largestGateAirport = this.Airline.Airports.OrderByDescending(a => a.Terminals.getNumberOfGates(this.Airline) / Convert.ToDouble(a.Terminals.getInuseGates())).FirstOrDefault();

            ContentControl ccLargestAirport = new ContentControl();

            ccLargestAirport.SetResourceReference(ContentControl.ContentTemplateProperty, "AirportCountryLink");
            ccLargestAirport.Content = largestGateAirport;
            ccLargestAirport.ToolTip = UICreator.CreateToolTip("The greatest % of owned gates in use");

            lbInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineDestinations", "1010"), ccLargestAirport));

            Airport smallestGateAirport = this.Airline.Airports.OrderBy(a => a.Terminals.getNumberOfGates(this.Airline) / Convert.ToDouble(a.Terminals.getInuseGates())).FirstOrDefault();

            ContentControl ccSmallestAirport = new ContentControl();

            ccSmallestAirport.SetResourceReference(ContentControl.ContentTemplateProperty, "AirportCountryLink");
            ccSmallestAirport.Content = smallestGateAirport;
            ccSmallestAirport.ToolTip = UICreator.CreateToolTip("The smallest % of owned gates in use");

            lbInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineDestinations", "1011"), ccSmallestAirport));

            return(informationPanel);
        }
        public PageAirlineDestinations(Airline airline)
        {
            InitializeComponent();

            this.Airline = airline;

            StackPanel panelDestinations = new StackPanel();

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

            TextBlock txtDestinationsHeader = new TextBlock();

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

            panelDestinations.Children.Add(txtDestinationsHeader);

            ListBox lbDestinations = new ListBox();

            lbDestinations.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbDestinations.ItemTemplate = this.Resources["AirportItem"] as DataTemplate;
            // chs, 2011-10-11 changed the max height so all elements are visible
            lbDestinations.MaxHeight = (GraphicsHelpers.GetContentHeight() - 100) / 2;

            this.Airline.Airports.ForEach(a => lbDestinations.Items.Add(a));

            panelDestinations.Children.Add(lbDestinations);

            WrapPanel panelButtons = new WrapPanel();

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

            panelDestinations.Children.Add(panelButtons);

            Button btnDestinations = new Button();

            btnDestinations.Uid = "1002";
            btnDestinations.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnDestinations.Width   = Double.NaN;
            btnDestinations.Height  = Double.NaN;
            btnDestinations.Content = Translator.GetInstance().GetString("PageAirlineDestinations", btnDestinations.Uid);
            btnDestinations.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnDestinations.Click  += new RoutedEventHandler(btnDestinations_Click);
            btnDestinations.ToolTip = UICreator.CreateToolTip("Show your airline's destinations");

            panelButtons.Children.Add(btnDestinations);

            Button btnMap = new Button();

            btnMap.Uid = "201";
            btnMap.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnMap.Width   = Double.NaN;
            btnMap.Height  = Double.NaN;
            btnMap.Content = Translator.GetInstance().GetString("PageAirlineDestinations", btnMap.Uid);
            btnMap.Margin  = new Thickness(5, 0, 0, 0);
            btnMap.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnMap.Click += new RoutedEventHandler(btnMap_Click);

            panelButtons.Children.Add(btnMap);

            panelDestinations.Children.Add(createRoutesInformationPanel());

            this.Content = panelDestinations;
        }
Пример #25
0
        public PageAirliners()
        {
            InitializeComponent();

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


            airlinerType     = AirlinerType.TypeOfAirliner.Passenger;
            sortCriteriaUsed = a => a.BuiltDate;
            sortDescending   = true;

            StackPanel airlinersPanel = new StackPanel();

            airlinersPanel.Margin = new Thickness(10, 0, 10, 0);

            TextBlock txtNewHeader = new TextBlock();

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

            airlinersPanel.Children.Add(txtNewHeader);

            // chs, 2011-11-10 added a scroller so all elements are viewable

            ScrollViewer scroller = new ScrollViewer();

            scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroller.VerticalScrollBarVisibility   = ScrollBarVisibility.Disabled;

            airlinersPanel.Children.Add(scroller);

            StackPanel panelScroller = new StackPanel();

            panelScroller.Orientation = Orientation.Vertical;

            scroller.Content = panelScroller;

            ContentControl ccManufacturerHeader = new ContentControl();

            ccManufacturerHeader.ContentTemplate     = this.Resources["ManufacturerHeader"] as DataTemplate;
            ccManufacturerHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            panelScroller.Children.Add(ccManufacturerHeader);

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

            panelScroller.Children.Add(lbManufacturers);

            TextBlock txtUsedHeader = new TextBlock();

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

            airlinersPanel.Children.Add(txtUsedHeader);

            WrapPanel airlinerTypePanel = new WrapPanel();

            airlinersPanel.Children.Add(airlinerTypePanel);

            RadioButton rbPassengerAirliner = new RadioButton();

            rbPassengerAirliner.GroupName = "AirlinerRouteType";
            rbPassengerAirliner.IsChecked = true;
            rbPassengerAirliner.Tag       = AirlinerType.TypeOfAirliner.Passenger;
            rbPassengerAirliner.Checked  += rbRouteType_Checked;
            rbPassengerAirliner.Content   = Translator.GetInstance().GetString("PageAirliners", "1003");

            airlinerTypePanel.Children.Add(rbPassengerAirliner);

            RadioButton rbCargoAirliner = new RadioButton();

            rbCargoAirliner.GroupName = "AirlinerRouteType";
            rbCargoAirliner.Margin    = new Thickness(5, 0, 0, 0);
            rbCargoAirliner.Tag       = AirlinerType.TypeOfAirliner.Cargo;
            rbCargoAirliner.Checked  += rbRouteType_Checked;
            rbCargoAirliner.Content   = Translator.GetInstance().GetString("PageAirliners", "1004");

            airlinerTypePanel.Children.Add(rbCargoAirliner);

            ContentControl lblUsedHeader = new ContentControl();

            lblUsedHeader.ContentTemplate     = this.Resources["AirlinersUsedHeader"] as DataTemplate;
            lblUsedHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            airlinersPanel.Children.Add(lblUsedHeader);

            lbUsedAirliners = new ListBox();
            lbUsedAirliners.ItemTemplate = this.Resources["AirlinerUsedItem"] as DataTemplate;
            lbUsedAirliners.Height       = (GraphicsHelpers.GetContentHeight() - 150) / 2;
            lbUsedAirliners.ItemContainerStyleSelector = new ListBoxItemStyleSelector();

            airlinersPanel.Children.Add(lbUsedAirliners);

            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.Margin = new Thickness(0, 5, 0, 0);
            btnSearch.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnSearch.Click += new RoutedEventHandler(btnSearch_Click);

            airlinersPanel.Children.Add(btnSearch);

            showUsedAirliners(Airliners.GetAirlinersForSale());

            StandardContentPanel panelContent = new StandardContentPanel();

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

            sideFrame = new Frame();

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

            base.setContent(panelContent);

            base.setHeaderContent(this.Title);


            showPage(this);

            showManufacturers();
        }
Пример #26
0
        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)); }));

            cbAirline.ItemsSource = airlines;

            panelAirline.Children.Add(cbAirline);

            Button btnAddAirline = new Button();

            btnAddAirline.Margin     = new Thickness(5, 0, 0, 0);
            btnAddAirline.Background = Brushes.Transparent;
            btnAddAirline.Click     += new RoutedEventHandler(btnAddAirline_Click);

            Image imgAddAirline = new Image();

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

            btnAddAirline.Content = imgAddAirline;

            panelAirline.Children.Add(btnAddAirline);

            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1002"), panelAirline));

            txtIATA = UICreator.CreateTextBlock("");
            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1003"), txtIATA));

            txtAirlineType = UICreator.CreateTextBlock("");
            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1021"), txtAirlineType));

            StackPanel panelCountry = new StackPanel();

            cbCountry = new ComboBox();
            cbCountry.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbCountry.SetResourceReference(ComboBox.ItemTemplateProperty, "CountryFlagLongItem");
            cbCountry.Width             = 150;
            cbCountry.SelectionChanged += cbCountry_SelectionChanged;

            panelCountry.Children.Add(cbCountry);

            cbLocalCurrency = new CheckBox();
            cbLocalCurrency.FlowDirection       = System.Windows.FlowDirection.RightToLeft;
            cbLocalCurrency.Content             = Translator.GetInstance().GetString("PageNewGame", "1014");
            cbLocalCurrency.VerticalAlignment   = System.Windows.VerticalAlignment.Bottom;
            cbLocalCurrency.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

            panelCountry.Children.Add(cbLocalCurrency);

            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1004"), panelCountry));


            txtName             = new TextBox();
            txtName.Background  = Brushes.Transparent;
            txtName.BorderBrush = Brushes.Black;
            txtName.Width       = 200;


            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1005"), txtName));

            // chs, 2011-19-10 added to show the airline color
            airlineColorRect                 = new Rectangle();
            airlineColorRect.Width           = 40;
            airlineColorRect.Height          = 20;
            airlineColorRect.StrokeThickness = 1;
            airlineColorRect.Stroke          = Brushes.Black;
            airlineColorRect.Fill            = new AirlineBrushConverter().Convert(Airlines.GetAirline("ZA")) as Brush;
            airlineColorRect.Margin          = new Thickness(0, 2, 0, 2);

            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1006"), airlineColorRect));

            cbAirport = new ComboBox();
            cbAirport.SetResourceReference(ComboBox.ItemTemplateProperty, "AirportCountryItem");
            cbAirport.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAirport.IsSynchronizedWithCurrentItem = true;
            cbAirport.HorizontalAlignment           = System.Windows.HorizontalAlignment.Left;
            cbAirport.SelectionChanged += new SelectionChangedEventHandler(cbAirports_SelectionChanged);

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

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

            cbAirport.ItemsSource = airportsView;

            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1007"), cbAirport));

            cbStartYear = new ComboBox();
            cbStartYear.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbStartYear.Width = 60;
            for (int i = GameObject.StartYear; i < DateTime.Now.Year + 2; i++)
            {
                cbStartYear.Items.Add(i);
            }

            cbStartYear.SelectionChanged += new SelectionChangedEventHandler(cbStartYear_SelectionChanged);

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1008"), cbStartYear));

            cbTimeZone = new ComboBox();
            cbTimeZone.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbTimeZone.Width             = 300;
            cbTimeZone.DisplayMemberPath = "DisplayName";
            cbTimeZone.SelectedValuePath = "DisplayName";


            foreach (GameTimeZone gtz in TimeZones.GetTimeZones())
            {
                cbTimeZone.Items.Add(gtz);
            }

            cbTimeZone.SelectedItem = TimeZones.GetTimeZones().Find(delegate(GameTimeZone gtz) { return(gtz.UTCOffset == new TimeSpan(0, 0, 0)); });

            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1009"), cbTimeZone));

            cbFocus = new ComboBox();
            cbFocus.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbFocus.Width = 100;

            foreach (Airline.AirlineFocus focus in Enum.GetValues(typeof(Airline.AirlineFocus)))
            {
                cbFocus.Items.Add(focus);
            }

            cbFocus.SelectedIndex = 0;

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1013"), cbFocus));

            WrapPanel panelDifficulty = new WrapPanel();

            cbDifficulty = new ComboBox();
            cbDifficulty.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbDifficulty.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbDifficulty.Width             = 100;
            cbDifficulty.DisplayMemberPath = "Name";
            cbDifficulty.SelectedValuePath = "Name";

            foreach (DifficultyLevel difficulty in DifficultyLevels.GetDifficultyLevels())
            {
                cbDifficulty.Items.Add(difficulty);
            }

            cbDifficulty.SelectedIndex = 0;

            panelDifficulty.Children.Add(cbDifficulty);

            Button btnAddDifficulty = new Button();

            btnAddDifficulty.Margin     = new Thickness(5, 0, 0, 0);
            btnAddDifficulty.Background = Brushes.Transparent;
            btnAddDifficulty.Click     += new RoutedEventHandler(btnAddDifficulty_Click);

            Image imgAddDifficulty = new Image();

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

            btnAddDifficulty.Content = imgAddDifficulty;

            panelDifficulty.Children.Add(btnAddDifficulty);

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1011"), panelDifficulty));

            WrapPanel panelOpponents = new WrapPanel();

            cbOpponents = new ComboBox();
            cbOpponents.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbOpponents.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbOpponents.Width = 50;
            cbOpponents.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Right;
            for (int i = 0; i < Airlines.GetAllAirlines().Count; i++)
            {
                cbOpponents.Items.Add(i);
            }

            cbOpponents.SelectedIndex = 3;

            panelOpponents.Children.Add(cbOpponents);

            cbSameRegion = new CheckBox();
            cbSameRegion.FlowDirection     = System.Windows.FlowDirection.RightToLeft;
            cbSameRegion.Content           = Translator.GetInstance().GetString("PageNewGame", "1017");
            cbSameRegion.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            cbSameRegion.Margin            = new Thickness(5, 0, 0, 0);

            panelOpponents.Children.Add(cbSameRegion);

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1010"), panelOpponents));

            WrapPanel panelOpponentSelect = new WrapPanel();

            RadioButton rbRandomOpponents = new RadioButton();

            rbRandomOpponents.IsChecked = true;
            rbRandomOpponents.GroupName = "Opponent";
            rbRandomOpponents.Content   = Translator.GetInstance().GetString("PageNewGame", "1018");
            rbRandomOpponents.Checked  += rbRandomOpponents_Checked;

            panelOpponentSelect.Children.Add(rbRandomOpponents);

            RadioButton rbSelectOpponents = new RadioButton();

            rbSelectOpponents.GroupName = "Opponent";
            rbSelectOpponents.Content   = Translator.GetInstance().GetString("PageNewGame", "1019");
            rbSelectOpponents.Checked  += rbSelectOpponents_Checked;
            rbSelectOpponents.Margin    = new Thickness(5, 0, 0, 0);

            panelOpponentSelect.Children.Add(rbSelectOpponents);

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1020"), panelOpponentSelect));

            cbDayTurnEnabled = new CheckBox();
            cbDayTurnEnabled.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            cbDayTurnEnabled.IsChecked         = true;

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1016"), cbDayTurnEnabled));

            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.Uid     = "203";
            btnCreate.Content = Translator.GetInstance().GetString("PageNewGame", btnCreate.Uid);
            btnCreate.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            panelButtons.Children.Add(btnCreate);

            btnBack = new Button();
            btnBack.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnBack.Height  = Double.NaN;
            btnBack.Width   = Double.NaN;
            btnBack.Uid     = "119";
            btnBack.Content = Translator.GetInstance().GetString("General", btnBack.Uid);
            btnBack.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnBack.Margin     = new Thickness(5, 0, 0, 0);
            btnBack.Click     += btnBack_Click;
            btnBack.Visibility = System.Windows.Visibility.Collapsed;
            panelButtons.Children.Add(btnBack);

            Button btnExit = new Button();

            btnExit.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnExit.Height  = double.NaN;
            btnExit.Width   = double.NaN;
            btnExit.Uid     = "202";
            btnExit.Content = Translator.GetInstance().GetString("PageNewGame", btnExit.Uid);
            btnExit.Margin  = new Thickness(5, 0, 0, 0);
            btnExit.Click  += new RoutedEventHandler(btnCancel_Click);
            btnExit.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            panelButtons.Children.Add(btnExit);

            base.setTopMenu(new PageTopMenu());

            base.hideNavigator();

            base.hideBottomMenu();

            base.setContent(panelContent);

            base.setHeaderContent(Translator.GetInstance().GetString("PageNewGame", "200"));

            cbStartYear.SelectedItem = DateTime.Now.Year;



            showPage(this);
        }
Пример #27
0
        //private Slider slMarketingBudget;
        public PageAirlineFinances(Airline airline)
        {
            InitializeComponent();

            this.Language = XmlLanguage.GetLanguage(new CultureInfo(AppSettings.GetInstance().getLanguage().CultureInfo, true).IetfLanguageTag);

            this.Airline = airline;



            StackPanel panelFinances = new StackPanel();

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

            /*REMOVE THIS LINE AFTER 0.3.6 PUBLIC RELEASE ************************
             * WrapPanel panelMarketingBudget = new WrapPanel();
             *
             * double minValue = 0;
             * TextBlock txtSliderValue = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(minValue).ToString());
             * txtSliderValue.Margin = new Thickness(5, 0, 5, 0);
             * txtSliderValue.VerticalAlignment = System.Windows.VerticalAlignment.Top;
             * txtSliderValue.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
             *
             * panelFinances.Children.Add(txtSliderValue);
             *
             * Slider slMarketingBudget = new Slider();
             * slMarketingBudget.Value = 10000;
             * slMarketingBudget.Minimum = 1;
             * slMarketingBudget.Maximum = 10000000;
             * slMarketingBudget.Width = 400;
             * slMarketingBudget.Tag = txtSliderValue;
             * slMarketingBudget.IsDirectionReversed = false;
             * slMarketingBudget.IsSnapToTickEnabled = true;
             * slMarketingBudget.IsMoveToPointEnabled = true;
             * slMarketingBudget.TickFrequency = 25000;
             * slMarketingBudget.ValueChanged += new RoutedPropertyChangedEventHandler<double>(slider_ValueChanged);
             * slMarketingBudget.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.Both;
             *
             * panelFinances.Children.Add(slMarketingBudget);
             *
             * Button btnApplyMB = new Button();
             * btnApplyMB.Uid = "2001";
             * btnApplyMB.SetResourceReference(Button.StyleProperty, "RoundedButton");
             * btnApplyMB.Height = Double.NaN;
             * btnApplyMB.Width = Double.NaN;
             * btnApplyMB.Content = Translator.GetInstance().GetString("PageFinances", btnApplyMB.Uid);
             * btnApplyMB.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
             * btnApplyMB.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
             * btnApplyMB.Margin = new Thickness(0, 10, 0, 10);
             * btnApplyMB.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
             * btnApplyMB.Click += new RoutedEventHandler(btnApplyMB_Click);
             * panelFinances.Children.Add(btnApplyMB);
             *
             * txtMarketingBudget = new TextBlock();
             * txtMarketingBudget.Margin = new Thickness(5, 0, 5, 0);
             * txtMarketingBudget.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
             * txtMarketingBudget.Text = Translator.GetInstance().GetString("PageFinances", "1001");
             * txtMarketingBudget.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
             *
             *
             * panelFinances.Children.Add(txtMarketingBudget);
             * REMOVE THIS LINE AFTER 0.3.6 PUBLIC RELEASE ********************/
            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("PageAirlineFinances", txtHeader.Uid);
            panelFinances.Children.Add(txtHeader);

            TextBlock txtSummary = new TextBlock();

            txtSummary.Uid = "1002";
            txtSummary.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtSummary.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush");
            txtSummary.FontWeight = FontWeights.Bold;
            txtSummary.Text       = Translator.GetInstance().GetString("PageAirlineFinances", txtSummary.Uid);
            panelFinances.Children.Add(txtSummary);



            ListBox lbSummary = new ListBox();

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

            //txtCurrentMoney = UICreator.CreateTextBlock(string.Format("{0:c}", this.Airline.Money));
            txtCurrentMoney            = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airline.Money).ToString());
            txtCurrentMoney.Foreground = new Converters.ValueIsMinusConverter().Convert(this.Airline.Money, null, null, null) as Brush;
            txtCurrentMoney.ToolTip    = UICreator.CreateToolTip("Current expendable cash");

            lbSummary.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineFinances", "1003"), txtCurrentMoney));

            //txtBalance = UICreator.CreateTextBlock(string.Format("{0:c}", this.Airline.Money - this.Airline.StartMoney));
            txtBalance            = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airline.Money - this.Airline.StartMoney).ToString());
            txtBalance.Foreground = new Converters.ValueIsMinusConverter().Convert(this.Airline.Money - this.Airline.StartMoney, null, null, null) as Brush;
            lbSummary.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirlineFinances", "1004"), txtBalance));
            txtBalance.ToolTip = UICreator.CreateToolTip("Total balance since start of game");

            ContentControl txtSpecifications = new ContentControl();

            txtSpecifications.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtSpecifications.ContentTemplate     = this.Resources["SpecsHeader"] as DataTemplate;
            txtSpecifications.Margin = new Thickness(0, 5, 0, 0);

            panelFinances.Children.Add(txtSpecifications);

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

            panelFinances.Children.Add(lbSpecifications);

            showSpecifications();

            StackPanel panelLoans = new StackPanel();

            panelLoans.Visibility = this.Airline.IsHuman ? Visibility.Visible : System.Windows.Visibility.Collapsed;
            panelLoans.Margin     = new Thickness(0, 5, 0, 0);

            panelFinances.Children.Add(panelLoans);

            TextBlock txtLoans = new TextBlock();

            txtLoans.Uid = "1005";
            txtLoans.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtLoans.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtLoans.FontWeight = FontWeights.Bold;
            txtLoans.Text       = Translator.GetInstance().GetString("PageAirlineFinances", txtLoans.Uid);
            panelLoans.Children.Add(txtLoans);

            ContentControl ccLoans = new ContentControl();

            ccLoans.ContentTemplate = this.Resources["LoansHeader"] as DataTemplate;

            panelLoans.Children.Add(ccLoans);

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

            panelLoans.Children.Add(lbLoans);

            Button btnLoan = new Button();

            btnLoan.Uid = "1006";
            btnLoan.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnLoan.Height = Double.NaN;
            btnLoan.Width  = Double.NaN;
            //btnLoan.Visibility = this.Airline.IsHuman ? Visibility.Visible : System.Windows.Visibility.Collapsed;
            btnLoan.Content             = Translator.GetInstance().GetString("PageAirlineFinances", btnLoan.Uid);
            btnLoan.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnLoan.Margin = new Thickness(0, 10, 0, 0);
            btnLoan.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnLoan.Click += new RoutedEventHandler(btnLoan_Click);
            panelLoans.Children.Add(btnLoan);

            showLoans(false);

            this.Content = panelFinances;

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

            //this.Unloaded += new RoutedEventHandler(PageAirlineFinances_Unloaded);
        }
Пример #28
0
        //creates the panel
        private void createPanel()
        {
            ScrollViewer scroller = new ScrollViewer();

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

            StackPanel panelAlliance = new StackPanel();

            WrapPanel panelHeader = new WrapPanel();

            panelAlliance.Children.Add(panelHeader);

            if (this.Alliance.Logo != null)
            {
                Image imgLogo = new Image();
                imgLogo.Source = new BitmapImage(new Uri(this.Alliance.Logo, UriKind.RelativeOrAbsolute));
                imgLogo.Width  = 32;
                imgLogo.Margin = new Thickness(0, 0, 10, 0);
                imgLogo.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                RenderOptions.SetBitmapScalingMode(imgLogo, BitmapScalingMode.HighQuality);
                panelHeader.Children.Add(imgLogo);
            }

            TextBlock txtAirlineName = UICreator.CreateTextBlock(this.Alliance.Name);

            txtAirlineName.FontSize          = 20;
            txtAirlineName.FontWeight        = FontWeights.Bold;
            txtAirlineName.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            panelHeader.Children.Add(txtAirlineName);


            ContentControl txtHeader = new ContentControl();

            txtHeader.ContentTemplate     = this.Resources["AirlinesHeader"] as DataTemplate;
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.Margin = new Thickness(0, 5, 0, 0);
            panelAlliance.Children.Add(txtHeader);


            ListBox lbMembers = new ListBox();

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

            List <Airline> airlines = this.Alliance.Members.Select(m => m.Airline).ToList();

            airlines.Sort((delegate(Airline a1, Airline a2) { return(a1.Profile.Name.CompareTo(a2.Profile.Name)); }));

            foreach (Airline airline in airlines)
            {
                lbMembers.Items.Add(airline);
            }

            panelAlliance.Children.Add(lbMembers);

            ContentControl txtPendingHeader = new ContentControl();

            txtPendingHeader.ContentTemplate     = this.Resources["PendingsHeader"] as DataTemplate;
            txtPendingHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtPendingHeader.Margin = new Thickness(0, 5, 0, 0);

            panelAlliance.Children.Add(txtPendingHeader);

            ListBox lbPendings = new ListBox();

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

            this.Alliance.PendingMembers.ToList().ForEach(p => lbPendings.Items.Add(p));

            panelAlliance.Children.Add(lbPendings);

            panelAlliance.Children.Add(createInfoPanel());

            Button btnMap = new Button();

            btnMap.Uid = "204";
            btnMap.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnMap.Height  = Double.NaN;
            btnMap.Width   = Double.NaN;
            btnMap.Content = Translator.GetInstance().GetString("PanelAlliance", btnMap.Uid);
            btnMap.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnMap.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnMap.Click += new RoutedEventHandler(btnMap_Click);
            btnMap.Margin = new Thickness(0, 5, 0, 0);

            panelAlliance.Children.Add(btnMap);

            panelAlliance.Children.Add(createButtonsPanel());

            scroller.Content = panelAlliance;

            this.Content = scroller;
        }
Пример #29
0
        public PageAirlines()
        {
            InitializeComponent();

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

            StackPanel airlinesPanel = new StackPanel();

            airlinesPanel.Margin = new Thickness(10, 0, 10, 0);

            ContentControl txtHeader = new ContentControl();

            txtHeader.ContentTemplate     = this.Resources["AirlinesHeader"] as DataTemplate;
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            //txtHeader.SetResourceReference(Label.BackgroundProperty, "HeaderBackgroundBrush");

            airlinesPanel.Children.Add(txtHeader);


            ListBox lbAirlines = new ListBox();

            lbAirlines.ItemTemplate = this.Resources["AirlineItem"] as DataTemplate;
            // chs, 2011-10-10 set max height so scroll bars are enabled
            lbAirlines.MaxHeight = GraphicsHelpers.GetContentHeight() - 100;
            lbAirlines.ItemContainerStyleSelector = new ListBoxItemStyleSelector();

            List <Airline> airlines = Airlines.GetAllAirlines().FindAll(a => !a.IsSubsidiary);

            //airlines.Sort((delegate(Airline a1, Airline a2) { return a1.Profile.Name.CompareTo(a2.Profile.Name); }));

            airlines = airlines.OrderBy(a => a.Profile.Name).ToList();

            airlines.Remove(GameObject.GetInstance().MainAirline);
            airlines.Insert(0, GameObject.GetInstance().MainAirline);

            foreach (Airline airline in airlines)
            {
                lbAirlines.Items.Add(airline);
                foreach (SubsidiaryAirline sAirline in airline.Subsidiaries)
                {
                    lbAirlines.Items.Add(sAirline);
                }
            }

            airlinesPanel.Children.Add(lbAirlines);

            airlinesPanel.Children.Add(createSymbolsPanel());

            StandardContentPanel panelContent = new StandardContentPanel();

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


            StackPanel panelSideMenu = new PanelAirlines();

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



            base.setContent(panelContent);

            base.setHeaderContent(this.Title);


            showPage(this);
        }
        public PagePlayScenario()
        {
            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;

            WrapPanel panelScenarios = new WrapPanel();

            panelContent.Children.Add(panelScenarios);

            StackPanel panelSelectScenarios = new StackPanel();

            panelScenarios.Children.Add(panelSelectScenarios);

            TextBlock txtHeader = new TextBlock();

            txtHeader.Width = 200;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight    = FontWeights.Bold;
            txtHeader.Uid           = "1001";
            txtHeader.TextAlignment = TextAlignment.Center;
            txtHeader.Text          = Translator.GetInstance().GetString("PagePlayScenario", txtHeader.Uid);
            panelSelectScenarios.Children.Add(txtHeader);

            ListBox lbScenarios = new ListBox();

            lbScenarios.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbScenarios.Height       = GraphicsHelpers.GetContentHeight() / 2;
            lbScenarios.ItemTemplate = this.Resources["ScenarioItem"] as DataTemplate;
            lbScenarios.Width        = 200;


            foreach (Scenario scenario in Scenarios.GetScenarios())
            {
                lbScenarios.Items.Add(scenario);
            }

            panelSelectScenarios.Children.Add(lbScenarios);

            panelScenarios.Children.Add(createScenarioPanel());

            Button btnExit = new Button();

            btnExit.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnExit.Height              = double.NaN;
            btnExit.Width               = double.NaN;
            btnExit.Uid                 = "200";
            btnExit.Content             = Translator.GetInstance().GetString("PagePlayScenario", btnExit.Uid);
            btnExit.Margin              = new Thickness(0, 10, 0, 0);
            btnExit.Click              += btnExit_Click;
            btnExit.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            btnExit.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            panelContent.Children.Add(btnExit);



            base.setTopMenu(new PageTopMenu());

            base.hideNavigator();

            base.hideBottomMenu();

            base.setContent(panelContent);

            base.setHeaderContent(Translator.GetInstance().GetString("PagePlayScenario", "1000"));



            showPage(this);
        }