public PageAirlineFinances(AirlineMVVM airline)
        {
            this.Airline     = airline;
            this.DataContext = this.Airline;

            InitializeComponent();
        }
        public PageAirlineRatings(AirlineMVVM airline)
        {
            this.AirlineRatings    = new ObservableCollection <AirlineScoreMVVM>();
            this.AirlineScores     = new ObservableCollection <AirlineScoreMVVM>();
            this.AirlineStatistics = new ObservableCollection <AirlineStatisticsMVVM>();
            this.Airline           = airline;
            this.DataContext       = this.Airline;

            InitializeComponent();

            this.AirlineRatings.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1007"), this.Airline.Airline.Ratings.SecurityRating));
            this.AirlineRatings.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1008"), this.Airline.Airline.Ratings.SafetyRating));
            this.AirlineRatings.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1009"), this.Airline.Airline.Ratings.EmployeeHappinessRating));
            this.AirlineRatings.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1010"), this.Airline.Airline.Ratings.CustomerHappinessRating));
            this.AirlineRatings.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1011"), this.Airline.Airline.Ratings.MaintenanceRating));

            this.AirlineScores.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1012"), this.Airline.Airline.OverallScore));
            // this.AirlineScores.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1013"), this.Airline.Airline.Reputation));<
            this.AirlineScores.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1014"), (int)StatisticsHelpers.GetOnTimePercent(this.Airline.Airline)));
            this.AirlineScores.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1015"), (int)(StatisticsHelpers.GetAirlineFillAverage(this.Airline.Airline) * 100)));

            this.AirlineStatistics.Add(new AirlineStatisticsMVVM(this.Airline.Airline, StatisticsTypes.GetStatisticsType("Passengers")));
            this.AirlineStatistics.Add(new AirlineStatisticsMVVM(this.Airline.Airline, StatisticsTypes.GetStatisticsType("Passengers%")));
            this.AirlineStatistics.Add(new AirlineStatisticsMVVM(this.Airline.Airline, StatisticsTypes.GetStatisticsType("Arrivals")));
        }
        public PageAirlineRatings(AirlineMVVM airline)
        {
            this.AirlineRatings = new ObservableCollection<AirlineScoreMVVM>();
            this.AirlineScores = new ObservableCollection<AirlineScoreMVVM>();
            this.AirlineStatistics = new ObservableCollection<AirlineStatisticsMVVM>();
            this.Airline = airline;
            this.DataContext = this.Airline;

            InitializeComponent();

            this.AirlineRatings.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1007"), this.Airline.Airline.Ratings.SecurityRating));
            this.AirlineRatings.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1008"), this.Airline.Airline.Ratings.SafetyRating));
            this.AirlineRatings.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1009"), this.Airline.Airline.Ratings.EmployeeHappinessRating));
            this.AirlineRatings.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1010"), this.Airline.Airline.Ratings.CustomerHappinessRating));
            this.AirlineRatings.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1011"), this.Airline.Airline.Ratings.MaintenanceRating));

            this.AirlineScores.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1012"), this.Airline.Airline.OverallScore));
               // this.AirlineScores.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1013"), this.Airline.Airline.Reputation));<
            this.AirlineScores.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1014"), (int)StatisticsHelpers.GetOnTimePercent(this.Airline.Airline)));
            this.AirlineScores.Add(new AirlineScoreMVVM(Translator.GetInstance().GetString("PageAirlineRatings", "1015"), (int)(StatisticsHelpers.GetAirlineFillAverage(this.Airline.Airline)*100)));

            this.AirlineStatistics.Add(new AirlineStatisticsMVVM(this.Airline.Airline, StatisticsTypes.GetStatisticsType("Passengers")));
            this.AirlineStatistics.Add(new AirlineStatisticsMVVM(this.Airline.Airline, StatisticsTypes.GetStatisticsType("Passengers%")));
            this.AirlineStatistics.Add(new AirlineStatisticsMVVM(this.Airline.Airline, StatisticsTypes.GetStatisticsType("Arrivals")));
        }
        public PageAirlineFinances(AirlineMVVM airline)
        {
            this.Airline = airline;
            this.DataContext = this.Airline;

            InitializeComponent();
        }
        public PageAirlineFleet(AirlineMVVM airline)
        {
            this.Airline = airline;
            this.DataContext = this.Airline;
            this.SelectedAirliners = new ObservableCollection<FleetAirliner>();

            InitializeComponent();
        }
        public PageAirlineFleet(AirlineMVVM airline)
        {
            this.Airline           = airline;
            this.DataContext       = this.Airline;
            this.SelectedAirliners = new ObservableCollection <FleetAirliner>();

            InitializeComponent();
        }
Exemple #7
0
        public PageAirlineEmployees(AirlineMVVM airline)
        {
            this.Airline     = airline;
            this.DataContext = this.Airline;

            this.Airline.resetFees();

            InitializeComponent();
        }
        public PageAirlineEmployees(AirlineMVVM airline)
        {
            this.Airline = airline;
            this.DataContext = this.Airline;

            this.Airline.resetFees();

            InitializeComponent();
        }
Exemple #9
0
        public PageAirlineInsurance(AirlineMVVM airline)
        {
            this.Airline     = airline;
            this.DataContext = this.Airline;

            InitializeComponent();

            this.Loaded += PageAirlineInsurance_Loaded;
        }
        public PageAirlineInsurance(AirlineMVVM airline)
        {
            this.Airline = airline;
            this.DataContext = this.Airline;

            InitializeComponent();

            this.Loaded += PageAirlineInsurance_Loaded;
        }
        public PageAirlineServices(AirlineMVVM airline)
        {
            this.Classes = new ObservableCollection<AirlineClassMVVM>();

            foreach (AirlinerClass.ClassType type in Enum.GetValues(typeof(AirlinerClass.ClassType)))
            {
                if ((int)type <= GameObject.GetInstance().GameTime.Year)
                {
                    AirlineClassMVVM rClass = new AirlineClassMVVM(type);

                    foreach (RouteFacility.FacilityType facilityType in Enum.GetValues(typeof(RouteFacility.FacilityType)))
                    {
                        if (GameObject.GetInstance().GameTime.Year >= (int)facilityType)
                        {
                            AirlineClassFacilityMVVM facility = new AirlineClassFacilityMVVM(facilityType);

                            facility.Facilities.Clear();

                            foreach (RouteFacility rFacility in AirlineHelpers.GetRouteFacilities(GameObject.GetInstance().HumanAirline, facilityType))
                                facility.Facilities.Add(rFacility);

                            facility.SelectedFacility = RouteFacilities.GetBasicFacility(facility.Type);//GetFacilities(rFacility.Type).OrderBy(f => f.ServiceLevel).First();

                            rClass.Facilities.Add(facility);
                        }
                    }
                    this.Classes.Add(rClass);
                }
            }

            this.Airline = airline;
            this.DataContext = this.Airline;
            this.Loaded += PageAirlineServices_Loaded;

            InitializeComponent();

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvFacilities.ItemsSource);
            view.GroupDescriptions.Clear();
            view.SortDescriptions.Clear();

            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Type");
            view.GroupDescriptions.Add(groupDescription);

            SortDescription sortTypeDescription = new SortDescription("Type", ListSortDirection.Ascending);
            view.SortDescriptions.Add(sortTypeDescription);

            SortDescription sortFacilityDescription = new SortDescription("Facility.Name", ListSortDirection.Ascending);
            view.SortDescriptions.Add(sortFacilityDescription);

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

            cbCancellationPolicy.SelectedItem = this.Airline.Airline.getAirlinePolicy("Cancellation Minutes").PolicyValue;
        }
        public PageAirlineInfo(AirlineMVVM airline)
        {
            this.Airline = airline;
            this.DataContext = this.Airline;
            this.AllAirports = new List<Airport>();
            this.SubsidiaryAirports = new List<Airport>();

            InitializeComponent();

            logoPath = AppSettings.getDataPath() + "\\graphics\\airlinelogos\\default.png";
            imgLogo.Source = new BitmapImage(new Uri(logoPath, UriKind.RelativeOrAbsolute));

            foreach (Airport airport in this.Airline.Airline.Airports.FindAll(a => a.Terminals.getFreeSlotsPercent(this.Airline.Airline) > 50))
                this.AllAirports.Add(airport);

            foreach (Airport airport in this.Airline.Airline.Airports.Where(a => a.Terminals.getFreeGates() > 0))
                this.SubsidiaryAirports.Add(airport);
        }
        public PageAirlineInfo(AirlineMVVM airline)
        {
            this.Airline = airline;
            this.DataContext = this.Airline;
            this.AllAirports = new List<Airport>();

            InitializeComponent();

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvFleet.ItemsSource);
            view.GroupDescriptions.Clear();

            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Purchased");
            view.GroupDescriptions.Add(groupDescription);

            logoPath = AppSettings.getDataPath() + "\\graphics\\airlinelogos\\default.png";
            imgLogo.Source = new BitmapImage(new Uri(logoPath, UriKind.RelativeOrAbsolute));

            foreach (Airport airport in this.Airline.Airline.Airports.FindAll(a => a.Terminals.getFreeSlotsPercent(this.Airline.Airline) > 50))
                this.AllAirports.Add(airport);
        }
Exemple #14
0
        public PageAirlineInfo(AirlineMVVM airline)
        {
            this.Airline            = airline;
            this.DataContext        = this.Airline;
            this.AllAirports        = new List <Airport>();
            this.SubsidiaryAirports = new List <Airport>();

            InitializeComponent();

            logoPath       = AppSettings.getDataPath() + "\\graphics\\airlinelogos\\default.png";
            imgLogo.Source = new BitmapImage(new Uri(logoPath, UriKind.RelativeOrAbsolute));

            foreach (Airport airport in this.Airline.Airline.Airports.FindAll(a => a.Terminals.getFreeSlotsPercent(this.Airline.Airline) > 50))
            {
                this.AllAirports.Add(airport);
            }

            foreach (Airport airport in this.Airline.Airline.Airports.Where(a => a.Terminals.getFreeGates() > 0))
            {
                this.SubsidiaryAirports.Add(airport);
            }
        }
Exemple #15
0
        public PageAirline(Airline airline)
        {
            this.Airline = new AirlineMVVM(airline);

            var airports = this.Airline.Airline.Airports;

            var routes = this.Airline.Airline.Routes.OrderByDescending(r => r.Balance);

            double totalProfit = routes.Sum(r => r.Balance);

            this.ProfitRoutes = new List <RouteProfitMVVM>();
            foreach (Route route in routes.Take(Math.Min(5, routes.Count())))
            {
                this.ProfitRoutes.Add(new RouteProfitMVVM(route, totalProfit));
            }

            this.MostGates         = airports.OrderByDescending(a => a.getAirlineContracts(this.Airline.Airline).Sum(c => c.NumberOfGates)).Take(Math.Min(5, airports.Count)).ToList();
            this.MostUsedAircrafts = new List <AirlineFleetSizeMVVM>();

            var query = this.Airline.Airline.Fleet.GroupBy(a => a.Airliner.Type)
                        .Select(group =>
                                new
            {
                Type  = group.Key,
                Fleet = group
            })
                        .OrderByDescending(g => g.Fleet.Count());

            foreach (var group in query)
            {
                this.MostUsedAircrafts.Add(new AirlineFleetSizeMVVM(group.Type, group.Fleet.Count()));
            }



            this.Loaded += PageAirline_Loaded;

            InitializeComponent();
        }
        public PageAirline(Airline airline)
        {
            this.Airline = new AirlineMVVM(airline);

            this.HasCodesharing = this.Airline.Airline.Codeshares.Exists(c => c.Airline1 == GameObject.GetInstance().HumanAirline || c.Airline2 == GameObject.GetInstance().HumanAirline);
            this.CanHaveAlliance = this.Airline.Airline.Alliances.Count == 0 && GameObject.GetInstance().HumanAirline.Alliances.Count > 0;
            this.ShowActionMenu = !this.Airline.Airline.IsHuman && (this.CanHaveAlliance || !this.HasCodesharing);

            var airports = this.Airline.Airline.Airports;
            var routes = this.Airline.Airline.Routes.OrderByDescending(r => r.Balance);

            double totalProfit = routes.Sum(r => r.Balance);

            this.ProfitRoutes = new List<RouteProfitMVVM>();
            foreach (Route route in routes.Take(Math.Min(5, routes.Count())))
            {
                this.ProfitRoutes.Add(new RouteProfitMVVM(route, totalProfit));
            }

            this.MostGates = airports.OrderByDescending(a => a.getAirlineContracts(this.Airline.Airline).Sum(c => c.NumberOfGates)).Take(Math.Min(5, airports.Count)).ToList();
            this.MostUsedAircrafts = new List<AirlineFleetSizeMVVM>();

            var types = this.Airline.Airline.Fleet.Select(a => a.Airliner.Type).Distinct();

            foreach (AirlinerType type in types)
            {
                int count = this.Airline.Airline.Fleet.Count(a => a.Airliner.Type == type);

                this.MostUsedAircrafts.Add(new AirlineFleetSizeMVVM(type, count));
            }

            this.MostUsedAircrafts = this.MostUsedAircrafts.OrderByDescending(a => a.Count).Take(Math.Min(5, this.MostUsedAircrafts.Count)).ToList();

            this.Loaded += PageAirline_Loaded;

            InitializeComponent();
        }
        public PageAirline(Airline airline)
        {
            this.Airline = new AirlineMVVM(airline);

            var airports = this.Airline.Airline.Airports;

            var routes = this.Airline.Airline.Routes.OrderByDescending(r => r.Balance);

            double totalProfit = routes.Sum(r => r.Balance);

            this.ProfitRoutes = new List<RouteProfitMVVM>();
            foreach (Route route in routes.Take(Math.Min(5, routes.Count())))
            {
                this.ProfitRoutes.Add(new RouteProfitMVVM(route, totalProfit));
            }

            this.MostGates = airports.OrderByDescending(a => a.getAirlineContracts(this.Airline.Airline).Sum(c => c.NumberOfGates)).Take(Math.Min(5, airports.Count)).ToList();
            this.MostUsedAircrafts = new List<AirlineFleetSizeMVVM>();

            var query = this.Airline.Airline.Fleet.GroupBy(a => a.Airliner.Type)
                  .Select(group =>
                        new
                        {
                            Type = group.Key,
                            Fleet = group
                        })
                  .OrderByDescending(g => g.Fleet.Count());

            foreach (var group in query)
            {
                this.MostUsedAircrafts.Add(new AirlineFleetSizeMVVM(group.Type,group.Fleet.Count()));
            }

            this.Loaded += PageAirline_Loaded;

            InitializeComponent();
        }
        public PageAirline(Airline airline)
        {
            this.Airline = new AirlineMVVM(airline);

            this.HasCodesharing  = this.Airline.Airline.Codeshares.Exists(c => c.Airline1 == GameObject.GetInstance().HumanAirline || c.Airline2 == GameObject.GetInstance().HumanAirline);
            this.CanHaveAlliance = this.Airline.Airline.Alliances.Count == 0 && GameObject.GetInstance().HumanAirline.Alliances.Count > 0;
            this.ShowActionMenu  = !this.Airline.Airline.IsHuman && (this.CanHaveAlliance || !this.HasCodesharing);

            var airports = this.Airline.Airline.Airports;
            var routes   = this.Airline.Airline.Routes.OrderByDescending(r => r.Balance);

            double totalProfit = routes.Sum(r => r.Balance);

            this.ProfitRoutes = new List <RouteProfitMVVM>();
            foreach (Route route in routes.Take(Math.Min(5, routes.Count())))
            {
                this.ProfitRoutes.Add(new RouteProfitMVVM(route, totalProfit));
            }

            this.MostGates         = airports.OrderByDescending(a => a.getAirlineContracts(this.Airline.Airline).Sum(c => c.NumberOfGates)).Take(Math.Min(5, airports.Count)).ToList();
            this.MostUsedAircrafts = new List <AirlineFleetSizeMVVM>();

            var types = this.Airline.Airline.Fleet.Select(a => a.Airliner.Type).Distinct();

            foreach (AirlinerType type in types)
            {
                int count = this.Airline.Airline.Fleet.Count(a => a.Airliner.Type == type);

                this.MostUsedAircrafts.Add(new AirlineFleetSizeMVVM(type, count));
            }

            this.MostUsedAircrafts = this.MostUsedAircrafts.OrderByDescending(a => a.Count).Take(Math.Min(5, this.MostUsedAircrafts.Count)).ToList();

            this.Loaded += PageAirline_Loaded;

            InitializeComponent();
        }
        public PageAirlineInfo(AirlineMVVM airline)
        {
            this.Airline     = airline;
            this.DataContext = this.Airline;
            this.AllAirports = new List <Airport>();

            InitializeComponent();

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvFleet.ItemsSource);

            view.GroupDescriptions.Clear();

            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Purchased");

            view.GroupDescriptions.Add(groupDescription);

            logoPath       = AppSettings.getDataPath() + "\\graphics\\airlinelogos\\default.png";
            imgLogo.Source = new BitmapImage(new Uri(logoPath, UriKind.RelativeOrAbsolute));

            foreach (Airport airport in this.Airline.Airline.Airports.FindAll(a => a.Terminals.getFreeSlotsPercent(this.Airline.Airline) > 50))
            {
                this.AllAirports.Add(airport);
            }
        }
        public PageAirlineServices(AirlineMVVM airline)
        {
            this.Classes = new ObservableCollection <AirlineClassMVVM>();

            foreach (AirlinerClass.ClassType type in Enum.GetValues(typeof(AirlinerClass.ClassType)))
            {
                if ((int)type <= GameObject.GetInstance().GameTime.Year)
                {
                    AirlineClassMVVM rClass = new AirlineClassMVVM(type);

                    foreach (RouteFacility.FacilityType facilityType in Enum.GetValues(typeof(RouteFacility.FacilityType)))
                    {
                        if (GameObject.GetInstance().GameTime.Year >= (int)facilityType)
                        {
                            AirlineClassFacilityMVVM facility = new AirlineClassFacilityMVVM(facilityType);

                            facility.Facilities.Clear();

                            foreach (RouteFacility rFacility in AirlineHelpers.GetRouteFacilities(GameObject.GetInstance().HumanAirline, facilityType))
                            {
                                facility.Facilities.Add(rFacility);
                            }

                            facility.SelectedFacility = RouteFacilities.GetBasicFacility(facility.Type);//GetFacilities(rFacility.Type).OrderBy(f => f.ServiceLevel).First();


                            rClass.Facilities.Add(facility);
                        }
                    }
                    this.Classes.Add(rClass);
                }
            }

            this.Airline     = airline;
            this.DataContext = this.Airline;
            this.Loaded     += PageAirlineServices_Loaded;

            InitializeComponent();

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvFacilities.ItemsSource);

            view.GroupDescriptions.Clear();
            view.SortDescriptions.Clear();

            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Type");

            view.GroupDescriptions.Add(groupDescription);

            SortDescription sortTypeDescription = new SortDescription("Type", ListSortDirection.Ascending);

            view.SortDescriptions.Add(sortTypeDescription);

            SortDescription sortFacilityDescription = new SortDescription("Facility.Name", ListSortDirection.Ascending);

            view.SortDescriptions.Add(sortFacilityDescription);

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

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