//adds a route airliner class to the route public CombiRoute(string id, Airport destination1, Airport destination2, DateTime startDate, double farePrice, double pricePerUnit) : base(id, destination1, destination2, startDate,farePrice) { this.Type = RouteType.Mixed; this.PricePerUnit = pricePerUnit; }
public static object ShowPopUp(Airline airline,Airport airport) { PopUpWindow window = new PopUpAddCooperation(airline,airport); window.ShowDialog(); return window.Selected; }
public ScenarioPassengerDemand(double factor, DateTime enddate, Country country, Airport airport) { this.Country = country; this.Factor = factor; this.EndDate = enddate; this.Airport = airport; }
public static object ShowPopUp(Airport airport) { PopUpWindow window = new PopUpAirportContract(airport); window.ShowDialog(); return window.Selected; }
public ScenarioAirlineRoute(Airport destination1, Airport destination2, AirlinerType airlinertype, int quantity) { this.Destination1 = destination1; this.Destination2 = destination2; this.AirlinerType = airlinertype; this.Quantity = quantity; }
public AirlineAirportFacility(Airline airline, Airport airport, AirportFacility facility, DateTime date) { this.Airline = airline; this.Facility = facility; this.FinishedDate = date; this.Airport = airport; }
public PageAirport(Airport airport) { InitializeComponent(); this.Uid = "1000"; this.Title = Translator.GetInstance().GetString("PageAirport", this.Uid); this.Airport = airport; StackPanel airportPanel = new StackPanel(); airportPanel.Margin = new Thickness(10, 0, 10, 0); airportPanel.Children.Add(createQuickInfoPanel()); airportPanel.Children.Add(createPassengersPanel()); //airportPanel.Children.Add(createFlightsPanel()); //airportPanel.Children.Add(createArrivalsPanel()); //airportPanel.Children.Add(createDeparturesPanel()); StandardContentPanel panelContent = new StandardContentPanel(); panelContent.setContentPage(airportPanel, StandardContentPanel.ContentLocation.Left); StackPanel panelSideMenu = new PanelAirport(this.Airport); panelContent.setContentPage(panelSideMenu, StandardContentPanel.ContentLocation.Right); base.setContent(panelContent); base.setHeaderContent(this.Title + " - " + this.Airport.Profile.Name); showPage(this); }
//for creating a new terminal public PopUpTerminal(Airport airport) { this.Airport = airport; InitializeComponent(); this.Uid = "1000"; this.Title = Translator.GetInstance().GetString("PopUpTerminal", this.Uid); this.Width = 400; this.Height = 200; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; StackPanel mainPanel = new StackPanel(); mainPanel.Margin = new Thickness(10, 10, 10, 10); ListBox lbTerminal = new ListBox(); lbTerminal.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbTerminal.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem"); mainPanel.Children.Add(lbTerminal); // chs 28-01-12: added for name of terminal txtName = new TextBox(); txtName.Background = Brushes.Transparent; txtName.BorderBrush = Brushes.Black; txtName.IsEnabled = this.Terminal == null; txtName.Width = 100; txtName.Text = this.Terminal == null ? "Terminal" : this.Terminal.Name; lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal","1007"),txtName)); // chs 11-09-11: added numericupdown for selecting number of gates nudGates = new ucNumericUpDown(); nudGates.Height = 30; nudGates.MaxValue = 50; nudGates.ValueChanged+=new RoutedPropertyChangedEventHandler<decimal>(nudGates_ValueChanged); nudGates.MinValue = 1; lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1001"), nudGates)); /* lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1002"), UICreator.CreateTextBlock(string.Format("{0:C}",this.Airport.getTerminalPrice())))); lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1003"), UICreator.CreateTextBlock(string.Format("{0:C}",this.Airport.getTerminalGatePrice())))); */ lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1002"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airport.getTerminalPrice()).ToString()))); lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1003"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airport.getTerminalGatePrice()).ToString()))); txtDaysToCreate = UICreator.CreateTextBlock("0 days"); lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1004"), txtDaysToCreate)); txtTotalPrice = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(0).ToString());//UICreator.CreateTextBlock(string.Format("{0:C}", 0)); lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1005"), txtTotalPrice)); mainPanel.Children.Add(createButtonsPanel()); nudGates.Value = 1; this.Content = mainPanel; }
/// <summary> /// Calculates the distance from /// the start airport to all other airports /// </summary> /// <param name="start">Startknoten</param> public void calculateDistance(Airport start) { this.Dist[start.Profile.IATACode] = 0; while (Basis.Count > 0) { Airport u = getNodeWithSmallestDistance(); if (u == null) { this.Basis.Clear(); } else { foreach (Airport v in getNeighbors(u)) { double alt = Dist[u.Profile.IATACode] + getDistanceBetween(u, v); if (alt < Dist[v.Profile.IATACode]) { this.Dist[v.Profile.IATACode] = alt; this.Previous[v.Profile.IATACode] = u; } } this.Basis.Remove(u); } } }
public AirportStatics(Airport airport) { this.AirportDistances = new Dictionary<Airport, double>(); this.PassengerDemand = new List<DestinationDemand>(); this.CargoDemand = new List<DestinationDemand>(); this.Airport = airport; }
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; }
public Alliance(DateTime formationDate, string name, Airport headquarter) { this.FormationDate = formationDate; this.Name = name; this.Members = new List<AllianceMember>(); this.PendingMembers = new List<PendingAllianceMember>(); this.Headquarter = headquarter; }
//adds a distance to the airport public void addDistance(Airport airport, double distance) { lock (this.AirportDistances) { if (!this.AirportDistances.ContainsKey(airport)) this.AirportDistances.Add(airport, distance); } }
public PopUpAirportContract(Airport airport) { this.Airport = airport; this.DataContext = this.Airport; InitializeComponent(); }
public AirportMVVM(Airport airport) { this.Airport = airport; this.IsHuman = GameObject.GetInstance().HumanAirline.Airports.Contains(this.Airport); this.NumberOfFreeGates = this.Airport.Terminals.NumberOfFreeGates; this.NumberOfAirlines = this.Airport.AirlineContracts.Select(c => c.Airline).Distinct().Count(); this.NumberOfRoutes = AirportHelpers.GetAirportRoutes(this.Airport).Count; }
public Terminal(Airport airport, Airline airline,string name, int gates, DateTime deliveryDate) { this.Airport = airport; this.Airline = airline; this.Name = name; this.DeliveryDate = new DateTime(deliveryDate.Year, deliveryDate.Month, deliveryDate.Day); this.Gates = new Gates(gates, this.DeliveryDate); }
public Alliance(DateTime formationDate, AllianceType type, string name, Airport headquarter) { this.FormationDate = formationDate; this.Type = type; this.Name = name; this.Members = new ObservableCollection<AllianceMember>(); this.PendingMembers = new ObservableCollection<PendingAllianceMember>(); this.Headquarter = headquarter; }
//checks an airport for new gates public static void CheckForExtendGates(Airport airport) { int minYearsBetweenExpansions = 5; if (airport.Terminals.getOrdereredGates() == 0 && GameObject.GetInstance().GameTime.AddYears(-minYearsBetweenExpansions) > airport.LastExpansionDate) { Terminal minTerminal = airport.Terminals.AirportTerminals.OrderBy(t => t.Gates.NumberOfGates).First(); Boolean newTerminal = minTerminal.Gates.NumberOfGates > 50; //extend existing if (!newTerminal) { int numberOfGates = Math.Max(5, minTerminal.Gates.NumberOfGates); int daysToBuild = numberOfGates * 10 + (newTerminal ? 60 : 0); long price = numberOfGates * airport.getTerminalGatePrice() + (newTerminal ? airport.getTerminalPrice() : 0); price = price / 3 * 4; if (airport.Income > price) { for (int i = 0; i < numberOfGates; i++) { Gate gate = new Gate(GameObject.GetInstance().GameTime.AddDays(daysToBuild)); gate.Airline = minTerminal.Airline; minTerminal.Gates.addGate(gate); } airport.Income -= price; airport.LastExpansionDate = GameObject.GetInstance().GameTime; } } //build new terminal else { int numberOfGates = airport.Terminals.getTerminals()[0].Gates.NumberOfDeliveredGates; int daysToBuild = numberOfGates * 10 + (newTerminal ? 60 : 0); long price = numberOfGates * airport.getTerminalGatePrice() + (newTerminal ? airport.getTerminalPrice() : 0); price = price / 3 * 4; if (airport.Income > price) { Terminal terminal = new Terminal(airport, null, "Terminal", numberOfGates, GameObject.GetInstance().GameTime.AddDays(daysToBuild)); airport.addTerminal(terminal); airport.Income -= price; airport.LastExpansionDate = GameObject.GetInstance().GameTime; } } } }
public FutureSubsidiaryAirline(string name, string iata,Airport airport, Airline.AirlineMentality mentality, Airline.AirlineFocus market, Route.RouteType airlineRouteFocus, string logo) { this.Name = name; this.IATA = iata; this.PreferedAirport = airport; this.Mentality = mentality; this.Market = market; this.Logo = logo; this.AirlineRouteFocus = airlineRouteFocus; }
public PopUpBuildRunway(Airport airport) { this.Airport = airport; InitializeComponent(); this.Uid = "1000"; this.Title = Translator.GetInstance().GetString("PopUpBuildRunway", this.Uid); this.Width = 400; this.Height = 210; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; StackPanel mainPanel = new StackPanel(); mainPanel.Margin = new Thickness(10, 10, 10, 10); ListBox lbContent = new ListBox(); lbContent.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbContent.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem"); mainPanel.Children.Add(lbContent); txtName = new TextBox(); txtName.Width = 200; txtName.Background = Brushes.Transparent; txtName.TextChanged += new TextChangedEventHandler(txtName_TextChanged); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpBuildRunway", "1001"), txtName)); cbSurface = new ComboBox(); cbSurface.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbSurface.Width = 100; cbSurface.SelectedIndex = 0; foreach (Runway.SurfaceType surface in this.Airport.Runways.Select(r => r.Surface).Distinct()) cbSurface.Items.Add(surface); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpBuildRunway", "1002"), cbSurface)); cbLenght = new ComboBox(); cbLenght.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbLenght.Width = 100; //cbLenght.ItemStringFormat = new NumberMeterToUnitConverter().Convert("{0}").ToString(); cbLenght.SelectedIndex = 0; for (int i = 1500; i < 4500; i += 250) cbLenght.Items.Add(i); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpBuildRunway", "1003"), cbLenght)); mainPanel.Children.Add(createButtonsPanel()); this.Content = mainPanel; }
public FlightSchool(Airport airport) { Guid id = Guid.NewGuid(); this.Airport = airport; this.Name = string.Format("Flight School {0}", this.Airport.Profile.Town.Name); this.Students = new List<PilotStudent>(); this.Instructors = new List<Instructor>(); this.TrainingAircrafts = new List<TrainingAircraft>(); this.ID = id.ToString(); }
public static FleetAirliner BuyAirliner(Airline airline, Airliner airliner, Airport airport, double discount) { FleetAirliner fAirliner = AddAirliner(airline, airliner, airport,false); double price = airliner.getPrice() * ((100 - discount) / 100); AddAirlineInvoice(airline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Purchases, -price); return fAirliner; }
public WeatherAverage(int month, double temperatureMin, double temperatureMax,int precipitation, Weather.eWindSpeed windspeedMin, Weather.eWindSpeed windspeedMax, Country country, Town town,Airport airport) { this.Month = month; this.Airport = airport; this.Country = country; this.Town = town; this.TemperatureMin = temperatureMin; this.TemperatureMax = temperatureMax; this.WindSpeedMax = windspeedMax; this.WindSpeedMin = windspeedMin; this.Precipitation = precipitation; }
public PassengerRoute(string id, Airport destination1, Airport destination2,double farePrice) : base(RouteType.Passenger,id,destination1,destination2) { this.Classes = new List<RouteAirlinerClass>(); foreach (AirlinerClass.ClassType ctype in Enum.GetValues(typeof(AirlinerClass.ClassType))) { RouteAirlinerClass cl = new RouteAirlinerClass(ctype, RouteAirlinerClass.SeatingType.Reserved_Seating, farePrice); this.Classes.Add(cl); } }
public static FleetAirliner AddAirliner(Airline airline, Airliner airliner, Airport airport) { if (Countries.GetCountryFromTailNumber(airliner.TailNumber).Name != airline.Profile.Country.Name) airliner.TailNumber = airline.Profile.Country.TailNumbers.getNextTailNumber(); FleetAirliner fAirliner = new FleetAirliner(FleetAirliner.PurchasedType.Bought, GameObject.GetInstance().GameTime, airline, airliner, airport); airline.addAirliner(fAirliner); return fAirliner; }
public PageAirport(Airport airport) { this.Loaded += PageAirport_Loaded; this.Airport = new AirportMVVM(airport); this.Distances = new List<AirportDistanceMVVM>(); foreach (Airport destination in GameObject.GetInstance().HumanAirline.Airports.Where(a => a != this.Airport.Airport)) this.Distances.Add(new AirportDistanceMVVM(destination, MathHelpers.GetDistance(destination, this.Airport.Airport))); InitializeComponent(); }
public PageAirportTraffic(Airport airport) { this.Airport = airport; InitializeComponent(); StackPanel panelTraffic = new StackPanel(); panelTraffic.Margin = new Thickness(0, 10, 50, 0); TextBlock txtPassengerHeader = new TextBlock(); txtPassengerHeader.Uid = "1001"; txtPassengerHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtPassengerHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2"); txtPassengerHeader.FontWeight = FontWeights.Bold; txtPassengerHeader.Text = Translator.GetInstance().GetString("PageAirportTraffic", txtPassengerHeader.Uid); panelTraffic.Children.Add(txtPassengerHeader); ListBox lbPassengerDestinations = new ListBox(); lbPassengerDestinations.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbPassengerDestinations.ItemTemplate = this.Resources["DestinationItem"] as DataTemplate; lbPassengerDestinations.MaxHeight = (GraphicsHelpers.GetContentHeight() - 100)/2; var destinations = from a in Airports.GetAllActiveAirports() orderby this.Airport.getDestinationPassengerStatistics(a) descending select a; foreach (Airport a in destinations.Take(20)) lbPassengerDestinations.Items.Add(new KeyValuePair<Airport,long>(a,this.Airport.getDestinationPassengerStatistics(a))); panelTraffic.Children.Add(lbPassengerDestinations); TextBlock txtCargoHeader = new TextBlock(); txtCargoHeader.Margin = new Thickness(0, 10, 0, 0); txtCargoHeader.Uid = "1002"; txtCargoHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtCargoHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2"); txtCargoHeader.FontWeight = FontWeights.Bold; txtCargoHeader.Text = Translator.GetInstance().GetString("PageAirportTraffic", txtCargoHeader.Uid); panelTraffic.Children.Add(txtCargoHeader); ListBox lbCargoDestinations = new ListBox(); lbCargoDestinations.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbCargoDestinations.ItemTemplate = this.Resources["DestinationItem"] as DataTemplate; lbCargoDestinations.MaxHeight = (GraphicsHelpers.GetContentHeight() - 100) / 2; var cargoDestinations = from a in Airports.GetAllActiveAirports() orderby this.Airport.getDestinationCargoStatistics(a) descending select a; foreach (Airport a in destinations.Take(20)) lbCargoDestinations.Items.Add(new KeyValuePair<Airport, double>(a, this.Airport.getDestinationCargoStatistics(a))); panelTraffic.Children.Add(lbCargoDestinations); this.Content = panelTraffic; }
public AirportContract(Airline airline, Airport airport, DateTime date, int numberOfGates, int length, double yearlyPayment,Boolean payFull = false, Boolean isExclusiveDeal = false, Terminal terminal = null) { this.PayFull = payFull; this.Airline = airline; this.Airport = airport; this.ContractDate = date; this.Length = length; this.YearlyPayment = yearlyPayment; this.NumberOfGates = numberOfGates; this.IsExclusiveDeal = isExclusiveDeal; this.Terminal = terminal; this.ExpireDate = this.ContractDate.AddYears(this.Length); }
public Route(RouteType type, string id, Airport destination1, Airport destination2) { this.Type = type; this.Id = id; this.Destination1 = destination1; this.Destination2 = destination2; this.TimeTable = new RouteTimeTable(this); this.Invoices = new Invoices(); this.Statistics = new RouteStatistics(); this.Banned = false; this.Stopovers = new List<StopoverRoute>(); this.Season = Weather.Season.All_Year; }
public PopUpAddCooperation(Airline airline, Airport airport) { this.Types = new List<CooperationType>(); this.Airline = airline; this.Airport = airport; foreach (CooperationType type in CooperationTypes.GetCooperationTypes()) { if (!this.Airport.Cooperations.Exists(c => c.Airline == airline && c.Type == type) && type.AirportSizeRequired<=this.Airport.Profile.Size) this.Types.Add(type); } InitializeComponent(); }
//returns if the destination has passengers rate public Boolean hasDestinationPassengersRate(Airport destination) { return(this.Statics.hasDestinationPassengersRate(destination) || this.DestinationPassengers.Exists(a => a.Destination == destination.Profile.IATACode)); }
public Terminal(Airport airport, string name, int gates, DateTime deliveryDate) : this(airport, null, name, gates, deliveryDate) { }
public Terminals(Airport airport) { this.Airport = airport; this.AirportTerminals = new List <Terminal>(); }
//returns a destination cargo object public DestinationDemand getDestinationCargoObject(Airport destination) { return(this.DestinationCargo.Find(a => a.Destination == destination.Profile.IATACode)); }
//returns if the destination have statistics public Boolean hasDestinationPassengerStatistics(Airport destination) { return(this.DestinationPassengerStatistics.ContainsKey(destination)); }
//adds an airport public static void AddAirport(Airport airport) { airports.Add(airport); }
//returns if the destination have cargo statistics public Boolean hasDestinationCargStatistics(Airport destination) { return(this.DestinationCargoStatistics.ContainsKey(destination)); }
//returns if a specific airport is in the list public static Boolean Contains(Airport airport) { return(airports.Contains(airport)); }