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

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

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

                this.AllPilots.Remove(pilot);

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

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

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

                    cbAirliners.SelectedIndex = 0;

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

                        airliner.addPilot(pilot);
                    }
                }
            }
        }
        private void lnk_Pilot(object sender, RoutedEventArgs e)
        {
            Pilot pilot = (Pilot)((Hyperlink)sender).Tag;

            if (pilot.Airliner == null)
            {
                ComboBox cbAirliners = new ComboBox();
                cbAirliners.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
                cbAirliners.SelectedValuePath   = "Name";
                cbAirliners.DisplayMemberPath   = "Name";
                cbAirliners.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                cbAirliners.Width = 200;

                foreach (FleetAirliner airliner in GameObject.GetInstance().HumanAirline.Fleet.FindAll(f => f.Pilots.Count < f.Airliner.Type.CockpitCrew))
                {
                    cbAirliners.Items.Add(airliner);
                }

                cbAirliners.SelectedIndex = 0;

                if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PageAirlinePilots", "1002"), cbAirliners) == PopUpSingleElement.ButtonSelected.OK && cbAirliners.SelectedItem != null)
                {
                    FleetAirliner airliner = (FleetAirliner)cbAirliners.SelectedItem;
                    airliner.addPilot(pilot);

                    pilot.Airliner = airliner;
                }
            }
            else
            {
                if (pilot.Airliner.Status != FleetAirliner.AirlinerStatus.Stopped)
                {
                    WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2115"), Translator.GetInstance().GetString("MessageBox", "2115", "message"), WPFMessageBoxButtons.Ok);
                }
                else
                {
                    ComboBox cbAirliners = new ComboBox();
                    cbAirliners.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
                    cbAirliners.SelectedValuePath   = "Name";
                    cbAirliners.DisplayMemberPath   = "Name";
                    cbAirliners.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    cbAirliners.Width = 200;

                    foreach (FleetAirliner airliner in GameObject.GetInstance().HumanAirline.Fleet.FindAll(f => f.Pilots.Count < f.Airliner.Type.CockpitCrew && f != pilot.Airliner))
                    {
                        cbAirliners.Items.Add(airliner);
                    }

                    cbAirliners.SelectedIndex = 0;

                    if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PageAirlinePilots", "1002"), cbAirliners) == PopUpSingleElement.ButtonSelected.OK && cbAirliners.SelectedItem != null)
                    {
                        pilot.Airliner.removePilot(pilot);

                        FleetAirliner airliner = (FleetAirliner)cbAirliners.SelectedItem;
                        airliner.addPilot(pilot);

                        pilot.Airliner = airliner;
                    }
                }
            }

            showPilots();
        }
        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();
                    }
                }
            }
        }