public PageAirlinerAdvancedRoute(FleetAirliner airliner, PopUpAirlinerAutoRoutes parent, OnRouteChanged routeChanged)
        {
            this.ParentPage = parent;
            this.Airliner = airliner;
            this.RouteChanged += routeChanged;

            InitializeComponent();

            StackPanel panelMain = new StackPanel();

            panelMain.Children.Add(createNewEntryPanel());

            WrapPanel panelFlightTime = new WrapPanel();

            txtStopovers = UICreator.CreateTextBlock("");
            txtStopovers.Visibility = System.Windows.Visibility.Collapsed;
            txtStopovers.Margin = new Thickness(0, 0, 10, 0);
            panelFlightTime.Children.Add(txtStopovers);

            txtFlightTime = UICreator.CreateTextBlock("Flight time:");
            panelFlightTime.Children.Add(txtFlightTime);

            panelMain.Children.Add(panelFlightTime);

            this.Content = panelMain;

            cbOrigin.SelectedIndex = 0;
        }
        public PageAirlinerAdvancedRoute(FleetAirliner airliner, PopUpAirlinerAutoRoutes parent, OnRouteChanged routeChanged)
        {
            this.ParentPage    = parent;
            this.Airliner      = airliner;
            this.RouteChanged += routeChanged;

            InitializeComponent();

            StackPanel panelMain = new StackPanel();

            panelMain.Children.Add(createNewEntryPanel());

            WrapPanel panelFlightTime = new WrapPanel();

            txtStopovers            = UICreator.CreateTextBlock("");
            txtStopovers.Visibility = System.Windows.Visibility.Collapsed;
            txtStopovers.Margin     = new Thickness(0, 0, 10, 0);
            panelFlightTime.Children.Add(txtStopovers);

            txtFlightTime = UICreator.CreateTextBlock("Flight time:");
            panelFlightTime.Children.Add(txtFlightTime);

            panelMain.Children.Add(panelFlightTime);

            this.Content = panelMain;

            cbOrigin.SelectedIndex = 0;
        }
Exemplo n.º 3
0
        public PageAirlinerAutoRoute(FleetAirliner airliner, PopUpAirlinerAutoRoutes parent, OnRouteChanged routeChanged)
        {
            this.ParentPage = parent;

            this.Airliner = airliner;

            this.RouteChanged += routeChanged;

            InitializeComponent();

            StackPanel mainPanel = new StackPanel();

            mainPanel.Children.Add(createAutoGeneratePanel());

            this.Content = mainPanel;
        }
        public PageAirlinerAutoRoute(FleetAirliner airliner, PopUpAirlinerAutoRoutes parent, OnRouteChanged routeChanged)
        {
            this.ParentPage = parent;

            this.Airliner = airliner;

            this.RouteChanged += routeChanged;

            InitializeComponent();

            StackPanel mainPanel = new StackPanel();

            mainPanel.Children.Add(createAutoGeneratePanel());

            this.Content = mainPanel;
        }
Exemplo n.º 5
0
        private void lnkAirline_Click(object sender, RoutedEventArgs e)
        {
            FleetAirliner airliner = (FleetAirliner)((Hyperlink)sender).Tag;

            panelSideMenu.Children.Clear();


            if (airliner.NumberOfPilots == airliner.Airliner.Type.CockpitCrew)
            {
                PopUpAirlinerAutoRoutes.ShowPopUp(airliner);
                showFleet();
            }
            else
            {
                int missingPilots = airliner.Airliner.Type.CockpitCrew - airliner.NumberOfPilots;
                if (GameObject.GetInstance().HumanAirline.Pilots.FindAll(p => p.Airliner == null).Count >= missingPilots)
                {
                    WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2505"), string.Format(Translator.GetInstance().GetString("MessageBox", "2505", "message")), WPFMessageBoxButtons.YesNo);

                    if (result == WPFMessageBoxResult.Yes)
                    {
                        var unassignedPilots = GameObject.GetInstance().HumanAirline.Pilots.FindAll(p => p.Airliner == null).ToList();

                        for (int i = 0; i < missingPilots; i++)
                        {
                            unassignedPilots[i].Airliner = airliner;
                            airliner.addPilot(unassignedPilots[i]);
                        }

                        // PopUpAirlinerRoutes.ShowPopUp(airliner, true);
                        PopUpAirlinerAutoRoutes.ShowPopUp(airliner);

                        showFleet();
                    }
                }
                else
                {
                    Random rnd = new Random();
                    WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2506"), string.Format(Translator.GetInstance().GetString("MessageBox", "2506", "message"), missingPilots), WPFMessageBoxButtons.YesNo);

                    if (result == WPFMessageBoxResult.Yes)
                    {
                        while (airliner.Airliner.Type.CockpitCrew > airliner.NumberOfPilots)
                        {
                            var pilots = Pilots.GetUnassignedPilots(p => p.Profile.Town.Country == airliner.Airliner.Airline.Profile.Country);

                            if (pilots.Count == 0)
                            {
                                pilots = Pilots.GetUnassignedPilots(p => p.Profile.Town.Country.Region == airliner.Airliner.Airline.Profile.Country.Region);
                            }

                            if (pilots.Count == 0)
                            {
                                pilots = Pilots.GetUnassignedPilots();
                            }

                            Pilot pilot = pilots.First();

                            airliner.Airliner.Airline.addPilot(pilot);
                            pilot.Airliner = airliner;
                            airliner.addPilot(pilot);
                        }

                        //PopUpAirlinerRoutes.ShowPopUp(airliner, true);
                        PopUpAirlinerAutoRoutes.ShowPopUp(airliner);

                        showFleet();
                    }
                }
            }
        }