private void cbRegion_SelectionChanged(object sender, SelectionChangedEventArgs e) { Route.RouteType type = this.Airliner.Airliner.Type.TypeAirliner == AirlinerType.TypeOfAirliner.Cargo ? Route.RouteType.Cargo : Route.RouteType.Passenger; long requiredRunway = this.Airliner.Airliner.Type.MinRunwaylength; Region region = (Region)cbRegion.SelectedItem; cbRoute.Items.Clear(); if (region.Uid == "100") { foreach (Route route in this.Airliner.Airliner.Airline.Routes.FindAll(r => r.Type == type && this.Airliner.Airliner.Type.Range > r.getDistance() && !r.Banned && r.Destination1.getMaxRunwayLength() >= requiredRunway && r.Destination2.getMaxRunwayLength() >= requiredRunway).OrderBy(r => new AirportCodeConverter().Convert(r.Destination1)).ThenBy(r => new AirportCodeConverter().Convert(r.Destination2))) { cbRoute.Items.Add(route); } } else { var routes = this.Airliner.Airliner.Airline.Routes.FindAll(r => r.Type == type && this.Airliner.Airliner.Type.Range > r.getDistance() && !r.Banned && r.Destination1.getMaxRunwayLength() >= requiredRunway && r.Destination2.getMaxRunwayLength() >= requiredRunway && ((r.Destination1.Profile.Country.Region == region && r.Destination2.Profile.Country.Region == GameObject.GetInstance().HumanAirline.Profile.Country.Region) || (r.Destination2.Profile.Country.Region == region && r.Destination1.Profile.Country.Region == GameObject.GetInstance().HumanAirline.Profile.Country.Region) || (r.Destination1.Profile.Country.Region == region && r.Destination2.Profile.Country.Region == region))).OrderBy(r => new AirportCodeConverter().Convert(r.Destination1)).ThenBy(r => new AirportCodeConverter().Convert(r.Destination2)); foreach (Route route in routes) { cbRoute.Items.Add(route); } } cbRoute.SelectedIndex = 0; }
private void cbOrigin_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbOrigin.SelectedItem != null) { cbDestination.Items.Clear(); Airport origin = (Airport)cbOrigin.SelectedItem; Route.RouteType type = this.Airliner.Airliner.Type.TypeAirliner == AirlinerType.TypeOfAirliner.Cargo ? Route.RouteType.Cargo : Route.RouteType.Passenger; var routes = this.Airliner.Airliner.Airline.Routes.Where(r => r.Type == type && (r.Destination1 == origin || r.Destination2 == origin));//.Select(r => r.Destination1 == origin ? r.Destination2 : r.Destination1); foreach (Route route in routes) { Airport destination = route.Destination1 == origin ? route.Destination2 : route.Destination1; ComboBoxItem itemRoute = new ComboBoxItem(); itemRoute.SetResourceReference(ComboBoxItem.ContentTemplateProperty, "AirportIATACountryItem"); itemRoute.Tag = route; itemRoute.Content = destination; cbDestination.Items.Add(itemRoute); } cbDestination.SelectedIndex = 0; } }
private void createAirline() { string name = txtName.Text.Trim(); string iata = txtIATA.Text.Trim().ToUpper(); string ceo = txtCEO.Text.Trim(); Airline tAirline = Airlines.GetAirline(iata); if (tAirline != null) { Airlines.RemoveAirline(tAirline); } Country country = (Country)cbCountry.SelectedItem; string color = ((PropertyInfo)cbColor.SelectedItem).Name; AirlineProfile profile = new AirlineProfile(name, iata, color, ceo, false, 1950, 2199); profile.Countries = new List <Country>() { country }; profile.Country = country; profile.addLogo(new AirlineLogo(logoPath)); profile.PreferedAirport = cbAirport.SelectedItem != null ? (Airport)cbAirport.SelectedItem : null; Route.RouteType focus = rbPassengerType.IsChecked.Value ? Route.RouteType.Passenger : Route.RouteType.Cargo; Airline airline = new Airline(profile, Airline.AirlineMentality.Aggressive, Airline.AirlineFocus.Local, Airline.AirlineLicense.Domestic, focus); Airlines.AddAirline(airline); WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2405"), Translator.GetInstance().GetString("MessageBox", "2405", "message"), WPFMessageBoxButtons.Ok); }
public StartDataRoute(string destination1, string destination2, int opened, int closed, Route.RouteType routetype) { this.Opened = opened; this.Closed = closed; this.Destination1 = destination1; this.Destination2 = destination2; this.RouteType = routetype; }
public StartDataRoutes(string origin, int destinations, GeneralHelpers.Size minimumsize, Route.RouteType routetype) { this.Countries = new List <Country>(); this.Origin = origin; this.Destinations = destinations; this.MinimumSize = minimumsize; this.RouteType = routetype; }
private void rbRouteType_Checked(object sender, RoutedEventArgs e) { this.RouteType = (Route.RouteType)((RadioButton)sender).Tag; //rbPassenger.IsEnabled = false; //rbCargo.IsEnabled = false; createRoutePanel(); }
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 Route GetRoute(Route.RouteType type) { string route = string.Empty; if (parent != null) { route = parent.GetRouteString(type); } route += "/" + name; return(new Route(route, type)); }
public string GetRouteString(Route.RouteType type) { string route = string.Empty; if (Address.parent != null) { route = Address.parent.GetRouteString(type); } route += "/"; if (type == Route.RouteType.ID) { route += Address.ID; } else { route += Address.Name; } return(route); }
private void btnCreateSubsidiary_Click(object sender, RoutedEventArgs e) { string iata = txtIATA.Text.ToUpper().Trim(); string name = txtAirlineName.Text.Trim(); Airport airport = (Airport)cbAirport.SelectedItem; string color = ((PropertyInfo)cbColor.SelectedItem).Name; Route.RouteType focus = rbPassengerType.IsChecked.Value ? Route.RouteType.Passenger : Route.RouteType.Cargo; string pattern = @"^[A-Za-z0-9]+$"; Regex regex = new Regex(pattern); if (name.Length > 0 && iata.Length == 2 && regex.IsMatch(iata) && !Airlines.GetAllAirlines().Exists(a => a.Profile.IATACode == iata)) { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2402"), Translator.GetInstance().GetString("MessageBox", "2402", "message"), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { AirlineProfile profile = new AirlineProfile(name, iata, color, GameObject.GetInstance().MainAirline.Profile.CEO, false, GameObject.GetInstance().GameTime.Year, 2199); profile.Country = GameObject.GetInstance().MainAirline.Profile.Country; SubsidiaryAirline subAirline = new SubsidiaryAirline(GameObject.GetInstance().MainAirline, profile, Model.AirlineModel.Airline.AirlineMentality.Safe, Model.AirlineModel.Airline.AirlineFocus.Local, Model.AirlineModel.Airline.AirlineLicense.Domestic, focus); subAirline.addAirport(airport); subAirline.Profile.Logos.Clear(); subAirline.Profile.addLogo(new AirlineLogo(logoPath)); subAirline.Money = slMoney.Value; this.Airline.addSubsidiaryAirline(subAirline); } } else { WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2404"), Translator.GetInstance().GetString("MessageBox", "2404", "message"), WPFMessageBoxButtons.Ok); } }
public PageNewAirline() { InitializeComponent(); 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.Text = "Airline Profile"; panelContent.Children.Add(txtHeader); ListBox lbContent = new ListBox(); lbContent.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbContent.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem"); panelContent.Children.Add(lbContent); txtAirlineName = new TextBox(); txtAirlineName.Background = Brushes.Transparent; txtAirlineName.BorderBrush = Brushes.Black; txtAirlineName.Width = 200; txtAirlineName.TextChanged += new TextChangedEventHandler(txtIATA_TextChanged); lbContent.Items.Add(new QuickInfoValue("Airline Name", txtAirlineName)); txtIATA = new TextBox(); txtIATA.Background = Brushes.Transparent; txtIATA.BorderBrush = Brushes.Black; txtIATA.MaxLength = 2; txtIATA.Width = 25; txtIATA.TextChanged += new TextChangedEventHandler(txtIATA_TextChanged); lbContent.Items.Add(new QuickInfoValue("IATA Code", txtIATA)); // chs, 2011-20-10 changed to enable loading of logo WrapPanel panelAirlinerType = new WrapPanel(); RadioButton rbPassenger = new RadioButton(); rbPassenger.Content = "Passenger"; rbPassenger.GroupName = "AirlineFocus"; rbPassenger.IsChecked = true; rbPassenger.Tag = Route.RouteType.Passenger; rbPassenger.Checked += rbAirlineType_Checked; rbPassenger.Margin = new Thickness(5, 0, 0, 0); panelAirlinerType.Children.Add(rbPassenger); RadioButton rbCargo = new RadioButton(); rbCargo.Content = "Cargo"; rbCargo.GroupName = "AirlineFocus"; rbCargo.Tag = Route.RouteType.Cargo; rbCargo.Checked += rbAirlineType_Checked; panelAirlinerType.Children.Add(rbCargo); lbContent.Items.Add(new QuickInfoValue("Airline type", panelAirlinerType)); WrapPanel panelAirlineLogo = new WrapPanel(); imgLogo = new Image(); imgLogo.Source = new BitmapImage(new Uri(logoPath, UriKind.RelativeOrAbsolute)); imgLogo.Width = 32; imgLogo.Margin = new Thickness(0, 0, 5, 0); imgLogo.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; RenderOptions.SetBitmapScalingMode(imgLogo, BitmapScalingMode.HighQuality); panelAirlineLogo.Children.Add(imgLogo); Button btnLogo = new Button(); btnLogo.Content = "..."; btnLogo.Background = Brushes.Transparent; btnLogo.Click += new RoutedEventHandler(btnLogo_Click); btnLogo.Margin = new Thickness(5, 0, 0, 0); panelAirlineLogo.Children.Add(btnLogo); lbContent.Items.Add(new QuickInfoValue("Airline Logo", panelAirlineLogo)); cbColor = new ComboBox(); cbColor.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbColor.Width = 250; cbColor.ItemTemplate = this.Resources["ColorItem"] as DataTemplate; foreach (PropertyInfo c in typeof(Colors).GetProperties()) { cbColor.Items.Add(c); } cbColor.SelectedIndex = 0; lbContent.Items.Add(new QuickInfoValue("Airline Color", cbColor)); cbCountry = new ComboBox(); cbCountry.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbCountry.SetResourceReference(ComboBox.ItemTemplateProperty, "CountryFlagLongItem"); cbCountry.Width = 250; List <Country> countries = Countries.GetCountries(); countries.Sort(delegate(Country c1, Country c2) { return(c1.Name.CompareTo(c2.Name)); }); foreach (Country country in countries) { cbCountry.Items.Add(country); } cbCountry.SelectedItem = Countries.GetCountry("122"); lbContent.Items.Add(new QuickInfoValue("Country", cbCountry)); 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.Content = "Create Airline"; btnCreate.IsEnabled = false; btnCreate.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); panelButtons.Children.Add(btnCreate); Button btnCancel = new Button(); btnCancel.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnCancel.Height = Double.NaN; btnCancel.Width = Double.NaN; btnCancel.Content = "Cancel"; btnCancel.Margin = new Thickness(5, 0, 0, 0); btnCancel.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnCancel.Click += new RoutedEventHandler(btnCancel_Click); panelButtons.Children.Add(btnCancel); base.setTopMenu(new PageTopMenu()); base.hideNavigator(); base.hideBottomMenu(); base.setContent(panelContent); base.setHeaderContent("Create New Airline"); showPage(this); airlinerType = Route.RouteType.Passenger; }
private void rbAirlineType_Checked(object sender, RoutedEventArgs e) { airlinerType = (Route.RouteType)((RadioButton)sender).Tag; }
public Airline(AirlineProfile profile, AirlineMentality mentality, AirlineFocus marketFocus, AirlineLicense license, Route.RouteType routeFocus) { this.Scores = new AirlineScores(); this.Airports = new List <Airport>(); this.Fleet = new List <FleetAirliner>(); this._Routes = new List <Route>(); this.FutureAirlines = new List <FutureSubsidiaryAirline>(); this.Subsidiaries = new List <SubsidiaryAirline>(); this.Advertisements = new Dictionary <AdvertisementType.AirlineAdvertisementType, AdvertisementType>(); this.Statistics = new GeneralStatistics(); this.Facilities = new List <AirlineFacility>(); this.Invoices = new Invoices(); this.Budget = new AirlineBudget(); this.BudgetHistory = new Dictionary <DateTime, AirlineBudget>(); this.TestBudget = new Dictionary <DateTime, AirlineBudget>(); this.Profile = profile; this.AirlineRouteFocus = routeFocus; this.Loans = new List <Loan>(); this.Reputation = 50; this.Alliances = new List <Alliance>(); this.Mentality = mentality; this.MarketFocus = marketFocus; this.License = license; this.FlightCodes = new List <string>(); this.Policies = new List <AirlinePolicy>(); this.EventLog = new List <RandomEvent>(); this.Ratings = new AirlineRatings(); this.OverallScore = this.CountedScores = 0; this.GameScores = new Dictionary <DateTime, int>(); this.InsuranceClaims = new List <InsuranceClaim>(); this.InsurancePolicies = new List <AirlineInsurance>(); for (int i = 1; i < 10000; i++) { this.FlightCodes.Add(string.Format("{0}{1:0000}", this.Profile.IATACode, i)); } createStandardAdvertisement(); this.Pilots = new List <Pilot>(); this.FlightSchools = new List <FlightSchool>(); this.Budget = new AirlineBudget(); }
private void rbRouteType_Checked(object sender, RoutedEventArgs e) { string type = ((RadioButton)sender).Tag.ToString(); this.RouteType = (Route.RouteType)Enum.Parse(typeof(Route.RouteType), type, true); }
public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); Route.RouteType type = (Route.RouteType)EditorGUILayout.EnumPopup("Route Type", route.route_type); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed route type"); route.route_type = type; } EditorGUILayout.Separator(); EditorGUILayout.Separator(); EditorGUI.BeginChangeCheck(); preview_position = EditorGUILayout.Slider("Preview position", preview_position, 0.0f, 1.0f); if (EditorGUI.EndChangeCheck()) { MovePreview(); } EditorGUILayout.Separator(); EditorGUILayout.Separator(); if (GUILayout.Button("Add Stop")) { Undo.RecordObject(target, "added stop"); Vector3 stop = route.local_stops[route.local_stops.Length - 1] + Vector3.right; ArrayUtility.Add(ref route.local_stops, stop); ArrayUtility.Add(ref route.wait_times, 0); } EditorGUIUtility.labelWidth = 64; int delete = -1; for (int i = 0; i < route.local_stops.Length; ++i) { EditorGUI.BeginChangeCheck(); EditorGUILayout.Separator(); EditorGUILayout.Separator(); EditorGUILayout.BeginVertical(); int size = 64; EditorGUILayout.BeginVertical(GUILayout.Width(size)); EditorGUILayout.LabelField("Stop " + i, GUILayout.Width(size)); if (i != 0 && GUILayout.Button("Delete", GUILayout.Width(size))) { delete = i; } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); Vector3 new_stop; if (i == 0) { new_stop = route.local_stops[i]; } else { new_stop = EditorGUILayout.Vector3Field("Stop", route.local_stops[i]); } int new_time = EditorGUILayout.IntField("Wait Time", route.wait_times[i]); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "changed time or position"); route.wait_times[i] = new_time; route.local_stops[i] = new_stop; } } EditorGUIUtility.labelWidth = 0; if (delete != -1) { Undo.RecordObject(target, "Removed stop"); ArrayUtility.RemoveAt(ref route.local_stops, delete); ArrayUtility.RemoveAt(ref route.wait_times, delete); } }
//creates the panel for adding a new entry private StackPanel createNewEntryPanel() { StackPanel newEntryPanel = new StackPanel(); newEntryPanel.Margin = new Thickness(0, 10, 0, 0); WrapPanel entryPanel = new WrapPanel(); newEntryPanel.Children.Add(entryPanel); Route.RouteType type = this.Airliner.Airliner.Type.TypeAirliner == AirlinerType.TypeOfAirliner.Cargo ? Route.RouteType.Cargo : Route.RouteType.Passenger; var origins = this.Airliner.Airliner.Airline.Routes.Where(r => r.Type == type).SelectMany(r => r.getDestinations()).Distinct(); origins.OrderBy(a => a.Profile.Name); cbOrigin = new ComboBox(); cbOrigin.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbOrigin.SetResourceReference(ComboBox.ItemTemplateProperty, "AirportIATACountryItem"); cbOrigin.Width = 100; cbOrigin.SelectionChanged += cbOrigin_SelectionChanged; foreach (Airport origin in origins) { cbOrigin.Items.Add(origin); } entryPanel.Children.Add(cbOrigin); TextBlock txtTo = UICreator.CreateTextBlock("->"); txtTo.VerticalAlignment = System.Windows.VerticalAlignment.Center; txtTo.Margin = new Thickness(5, 0, 5, 0); entryPanel.Children.Add(txtTo); cbDestination = new ComboBox(); cbDestination.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbDestination.SelectionChanged += cbDestination_SelectionChanged; cbDestination.Width = 100; entryPanel.Children.Add(cbDestination); cbDay = new ComboBox(); cbDay.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbDay.Width = 100; cbDay.Margin = new Thickness(10, 0, 0, 0); cbDay.Items.Add("Daily"); foreach (DayOfWeek day in Enum.GetValues(typeof(DayOfWeek))) { cbDay.Items.Add(day); } cbDay.SelectedIndex = 0; entryPanel.Children.Add(cbDay); tpTime = new TimePicker(); tpTime.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; tpTime.EndTime = new TimeSpan(22, 0, 0); tpTime.StartTime = new TimeSpan(6, 0, 0); tpTime.Value = new DateTime(2011, 1, 1, 13, 0, 0); tpTime.Format = TimeFormat.ShortTime; tpTime.Background = Brushes.Transparent; tpTime.SetResourceReference(TimePicker.ForegroundProperty, "TextColor"); tpTime.BorderBrush = Brushes.Black; entryPanel.Children.Add(tpTime); cbFlightCode = new ComboBox(); cbFlightCode.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); foreach (string flightCode in this.Airliner.Airliner.Airline.getFlightCodes()) { cbFlightCode.Items.Add(flightCode); } cbFlightCode.SelectedIndex = 0; entryPanel.Children.Add(cbFlightCode); Button btnAdd = new Button(); btnAdd.Uid = "104"; btnAdd.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnAdd.Height = Double.NaN; btnAdd.Width = Double.NaN; btnAdd.Click += new RoutedEventHandler(btnAdd_Click); btnAdd.Margin = new Thickness(5, 0, 0, 0); btnAdd.Content = Translator.GetInstance().GetString("General", btnAdd.Uid); btnAdd.IsEnabled = cbOrigin.Items.Count > 0; btnAdd.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; btnAdd.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); entryPanel.Children.Add(btnAdd); return(newEntryPanel); }
private void rbRouteType_Checked(object sender, RoutedEventArgs e) { string type = ((RadioButton)sender).Tag.ToString(); RouteType = (Route.RouteType)Enum.Parse(typeof(Route.RouteType), type, true); while (Airports.Count > 0) { Airports.RemoveAt(Airports.Count - 1); } if (RouteType == Route.RouteType.Cargo) { var airports = GameObject.GetInstance() .HumanAirline.Airports.Where(a => a.GetAirlineContracts(GameObject.GetInstance().HumanAirline).Exists(c => c.TerminalType == Terminal.TerminalType.Cargo)).OrderByDescending( a => a == GameObject.GetInstance().HumanAirline.Airports[0]) .ThenBy(a => a.Profile.Country.Name) .ThenBy(a => a.Profile.Name); foreach (Airport airport in airports) { Airports.Add(airport); } } else if (RouteType == Route.RouteType.Helicopter) { var airports = GameObject.GetInstance() .HumanAirline.Airports.Where(a => a.Runways.Exists(r => r.Type == Runway.RunwayType.Helipad) && a.GetAirlineContracts(GameObject.GetInstance().HumanAirline).Exists(c => c.TerminalType == Terminal.TerminalType.Passenger)).OrderByDescending( a => a == GameObject.GetInstance().HumanAirline.Airports[0]) .ThenBy(a => a.Profile.Country.Name) .ThenBy(a => a.Profile.Name); foreach (Airport airport in airports) { Airports.Add(airport); } foreach (MVVMRouteClass rc in Classes) rc.IsUseable = rc.Type == AirlinerClass.ClassType.EconomyClass; } else { var airports = GameObject.GetInstance() .HumanAirline.Airports.Where(a => a.Runways.Exists(r => r.Type == Runway.RunwayType.Regular) && a.GetAirlineContracts(GameObject.GetInstance().HumanAirline).Exists(c => c.TerminalType == Terminal.TerminalType.Passenger)).OrderByDescending( a => a == GameObject.GetInstance().HumanAirline.Airports[0]) .ThenBy(a => a.Profile.Country.Name) .ThenBy(a => a.Profile.Name); foreach (Airport airport in airports) { Airports.Add(airport); } foreach (MVVMRouteClass rc in Classes) rc.IsUseable = true; } /* //sets the selected items for the facilities foreach (MVVMRouteClass rClass in this.Classes) { foreach (MVVMRouteFacility rFacility in rClass.Facilities) { rFacility.SelectedFacility = rFacility.Facilities.OrderBy(f => f.ServiceLevel).FirstOrDefault(); } }*/ }
public PageRoutePlanner(FleetAirliner airliner) { this.ShowSeason = Weather.Season.All_Year; this.Airliner = airliner; this.Entries = new ObservableCollection <RouteTimeTableEntry>(); this.Entries.CollectionChanged += Entries_CollectionChanged; this.ViewEntries = new ObservableCollection <RouteTimeTableEntry>(); this.ViewEntries.CollectionChanged += ViewEntries_CollectionChanged; this.IsLongRoute = false; this.AllRoutes = new List <RoutePlannerItemMVVM>(); this.Intervals = new ObservableCollection <int>() { 1, 2, 3, 4, 5, 6 }; this.Routes = new ObservableCollection <Route>(); Route.RouteType routeType = (Route.RouteType)Enum.Parse(typeof(Route.RouteType), this.Airliner.Airliner.Type.TypeAirliner.ToString(), true);; foreach (Route route in this.Airliner.Airliner.Airline.Routes.Where(r => r.getDistance() <= this.Airliner.Airliner.Type.Range && r.Type == routeType)) { this.Routes.Add(route); } this.AllRegions = new List <Region>(); this.AllRegions.Add(Regions.GetRegion("100")); var routeRegions = this.Routes.Select(r => r.Destination1.Profile.Country.Region).ToList(); routeRegions.AddRange(this.Routes.Select(r => r.Destination2.Profile.Country.Region)); foreach (Region region in routeRegions.Distinct()) { this.AllRegions.Add(region); } foreach (Route route in this.Airliner.Airliner.Airline.Routes.Where(r => r.getDistance() <= this.Airliner.Airliner.Type.Range && r.Type == routeType)) { this.AllRoutes.Add(new RoutePlannerItemMVVM(route, this.Airliner.Airliner.Type)); } this.OutboundAirports = new List <Airport>(); var routeAirports = this.Routes.Select(r => r.Destination1).ToList(); routeAirports.AddRange(this.Routes.Select(r => r.Destination2)); foreach (Airport airport in routeAirports.Distinct()) { this.OutboundAirports.Add(airport); } this.StartTimes = new ObservableCollection <TimeSpan>(); for (int i = 0; i < 20; i++) { this.StartTimes.Add(new TimeSpan(6, i * 15, 0)); } this.StopoverMinutes = new List <int>() { 45, 60, 75, 90, 105, 120 }; setCanTransferSchedule(); this.Loaded += PageRoutePlanner_Loaded; InitializeComponent(); }
public SubsidiaryAirline(Airline airline, AirlineProfile profile, AirlineMentality mentality, AirlineFocus market, AirlineLicense license, Route.RouteType routefocus) : base(profile, mentality, market, license, routefocus) { this.Airline = airline; foreach (AirlineLogo logo in this.Airline.Profile.Logos) { this.Profile.addLogo(logo); } }
public PopUpNewSubsidiary() { InitializeComponent(); logoPath = GameObject.GetInstance().HumanAirline.Profile.Logo; this.Uid = "1000"; this.Title = Translator.GetInstance().GetString("PopUpNewSubsidiary", this.Uid); this.Width = 500; this.Height = 400; 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); txtAirlineName = new TextBox(); txtAirlineName.Background = Brushes.Transparent; txtAirlineName.BorderBrush = Brushes.Black; txtAirlineName.Width = 200; txtAirlineName.TextChanged += new TextChangedEventHandler(txtIATA_TextChanged); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1001"), txtAirlineName)); txtIATA = new TextBox(); txtIATA.Background = Brushes.Transparent; txtIATA.BorderBrush = Brushes.Black; txtIATA.MaxLength = 2; txtIATA.Width = 25; txtIATA.TextChanged += new TextChangedEventHandler(txtIATA_TextChanged); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1002"), txtIATA)); WrapPanel panelAirlinerType = new WrapPanel(); RadioButton rbPassenger = new RadioButton(); rbPassenger.IsChecked = true; rbPassenger.Content = Translator.GetInstance().GetString("PopUpNewSubsidiary", "1007"); rbPassenger.Margin = new Thickness(5, 0, 0, 0); rbPassenger.Checked += rbAirlineType_Checked; rbPassenger.Tag = Route.RouteType.Passenger; rbPassenger.GroupName = "AirlineType"; panelAirlinerType.Children.Add(rbPassenger); RadioButton rbCargo = new RadioButton(); rbCargo.Tag = Route.RouteType.Cargo; rbCargo.GroupName = "AirlineType"; rbCargo.Content = Translator.GetInstance().GetString("PopUpNewSubsidiary", "1008"); rbCargo.Tag = Route.RouteType.Cargo; rbCargo.Checked+=rbAirlineType_Checked; panelAirlinerType.Children.Add(rbCargo); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1009"), panelAirlinerType)); airlineType = Route.RouteType.Passenger; WrapPanel panelAirlineLogo = new WrapPanel(); imgLogo = new Image(); imgLogo.Source = new BitmapImage(new Uri(logoPath, UriKind.RelativeOrAbsolute)); imgLogo.Width = 32; imgLogo.Margin = new Thickness(0, 0, 5, 0); imgLogo.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; RenderOptions.SetBitmapScalingMode(imgLogo, BitmapScalingMode.HighQuality); panelAirlineLogo.Children.Add(imgLogo); Button btnLogo = new Button(); btnLogo.Content = "..."; btnLogo.Background = Brushes.Transparent; btnLogo.Click += new RoutedEventHandler(btnLogo_Click); btnLogo.Margin = new Thickness(5, 0, 0, 0); panelAirlineLogo.Children.Add(btnLogo); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1003"), panelAirlineLogo)); cbColor = new ComboBox(); cbColor.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbColor.Width = 250; cbColor.ItemTemplate = this.Resources["ColorItem"] as DataTemplate; foreach (PropertyInfo c in typeof(Colors).GetProperties()) { cbColor.Items.Add(c); if (c.Name == GameObject.GetInstance().MainAirline.Profile.Color) cbColor.SelectedItem = c; } lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1004"), cbColor)); cbAirport = new ComboBox(); cbAirport.SetResourceReference(ComboBox.ItemTemplateProperty, "AirportCountryItem"); cbAirport.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); foreach (Airport airport in GameObject.GetInstance().MainAirline.Airports.FindAll(a=>a.Terminals.getFreeGates()>0)) { cbAirport.Items.Add(airport); } cbAirport.SelectedIndex = 0; lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1005"), cbAirport)); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary","1006"),createMoneySlider())); mainPanel.Children.Add(createButtonsPanel()); this.Content = mainPanel; }
public PageNewAirline() { InitializeComponent(); 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.Text = "Airline Profile"; panelContent.Children.Add(txtHeader); ListBox lbContent = new ListBox(); lbContent.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbContent.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem"); panelContent.Children.Add(lbContent); txtAirlineName = new TextBox(); txtAirlineName.Background = Brushes.Transparent; txtAirlineName.BorderBrush = Brushes.Black; txtAirlineName.Width = 200; txtAirlineName.TextChanged+=new TextChangedEventHandler(txtIATA_TextChanged); lbContent.Items.Add(new QuickInfoValue("Airline Name", txtAirlineName)); txtIATA = new TextBox(); txtIATA.Background = Brushes.Transparent; txtIATA.BorderBrush = Brushes.Black; txtIATA.MaxLength = 2; txtIATA.Width = 25; txtIATA.TextChanged += new TextChangedEventHandler(txtIATA_TextChanged); lbContent.Items.Add(new QuickInfoValue("IATA Code", txtIATA)); // chs, 2011-20-10 changed to enable loading of logo WrapPanel panelAirlinerType = new WrapPanel(); RadioButton rbPassenger = new RadioButton(); rbPassenger.Content = "Passenger"; rbPassenger.GroupName = "AirlineFocus"; rbPassenger.IsChecked = true; rbPassenger.Tag = Route.RouteType.Passenger; rbPassenger.Checked += rbAirlineType_Checked; rbPassenger.Margin = new Thickness(5, 0, 0, 0); panelAirlinerType.Children.Add(rbPassenger); RadioButton rbCargo = new RadioButton(); rbCargo.Content = "Cargo"; rbCargo.GroupName = "AirlineFocus"; rbCargo.Tag = Route.RouteType.Cargo; rbCargo.Checked += rbAirlineType_Checked; panelAirlinerType.Children.Add(rbCargo); lbContent.Items.Add(new QuickInfoValue("Airline type", panelAirlinerType)); WrapPanel panelAirlineLogo = new WrapPanel(); imgLogo = new Image(); imgLogo.Source = new BitmapImage(new Uri(logoPath, UriKind.RelativeOrAbsolute)); imgLogo.Width = 32; imgLogo.Margin = new Thickness(0, 0, 5, 0); imgLogo.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; RenderOptions.SetBitmapScalingMode(imgLogo, BitmapScalingMode.HighQuality); panelAirlineLogo.Children.Add(imgLogo); Button btnLogo = new Button(); btnLogo.Content = "..."; btnLogo.Background = Brushes.Transparent; btnLogo.Click += new RoutedEventHandler(btnLogo_Click); btnLogo.Margin = new Thickness(5, 0, 0, 0); panelAirlineLogo.Children.Add(btnLogo); lbContent.Items.Add(new QuickInfoValue("Airline Logo", panelAirlineLogo)); cbColor = new ComboBox(); cbColor.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbColor.Width = 250; cbColor.ItemTemplate = this.Resources["ColorItem"] as DataTemplate; foreach (PropertyInfo c in typeof(Colors).GetProperties()) cbColor.Items.Add(c); cbColor.SelectedIndex = 0; lbContent.Items.Add(new QuickInfoValue("Airline Color", cbColor)); cbCountry = new ComboBox(); cbCountry.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbCountry.SetResourceReference(ComboBox.ItemTemplateProperty, "CountryFlagLongItem"); cbCountry.Width = 250; List<Country> countries = Countries.GetCountries(); countries.Sort(delegate(Country c1, Country c2) { return c1.Name.CompareTo(c2.Name); }); foreach (Country country in countries) cbCountry.Items.Add(country); cbCountry.SelectedItem = Countries.GetCountry("122"); lbContent.Items.Add(new QuickInfoValue("Country", cbCountry)); 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.Content = "Create Airline"; btnCreate.IsEnabled = false; btnCreate.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); panelButtons.Children.Add(btnCreate); Button btnCancel = new Button(); btnCancel.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnCancel.Height = Double.NaN; btnCancel.Width = Double.NaN; btnCancel.Content = "Cancel"; btnCancel.Margin = new Thickness(5, 0, 0, 0); btnCancel.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnCancel.Click += new RoutedEventHandler(btnCancel_Click); panelButtons.Children.Add(btnCancel); base.setTopMenu(new PageTopMenu()); base.hideNavigator(); base.hideBottomMenu(); base.setContent(panelContent); base.setHeaderContent("Create New Airline"); showPage(this); airlinerType = Route.RouteType.Passenger; }
public PopUpNewSubsidiary() { InitializeComponent(); logoPath = GameObject.GetInstance().HumanAirline.Profile.Logo; this.Uid = "1000"; this.Title = Translator.GetInstance().GetString("PopUpNewSubsidiary", this.Uid); this.Width = 500; this.Height = 400; 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); txtAirlineName = new TextBox(); txtAirlineName.Background = Brushes.Transparent; txtAirlineName.BorderBrush = Brushes.Black; txtAirlineName.Width = 200; txtAirlineName.TextChanged += new TextChangedEventHandler(txtIATA_TextChanged); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1001"), txtAirlineName)); txtIATA = new TextBox(); txtIATA.Background = Brushes.Transparent; txtIATA.BorderBrush = Brushes.Black; txtIATA.MaxLength = 2; txtIATA.Width = 25; txtIATA.TextChanged += new TextChangedEventHandler(txtIATA_TextChanged); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1002"), txtIATA)); WrapPanel panelAirlinerType = new WrapPanel(); RadioButton rbPassenger = new RadioButton(); rbPassenger.IsChecked = true; rbPassenger.Content = Translator.GetInstance().GetString("PopUpNewSubsidiary", "1007"); rbPassenger.Margin = new Thickness(5, 0, 0, 0); rbPassenger.Checked += rbAirlineType_Checked; rbPassenger.Tag = Route.RouteType.Passenger; rbPassenger.GroupName = "AirlineType"; panelAirlinerType.Children.Add(rbPassenger); RadioButton rbCargo = new RadioButton(); rbCargo.Tag = Route.RouteType.Cargo; rbCargo.GroupName = "AirlineType"; rbCargo.Content = Translator.GetInstance().GetString("PopUpNewSubsidiary", "1008"); rbCargo.Tag = Route.RouteType.Cargo; rbCargo.Checked += rbAirlineType_Checked; panelAirlinerType.Children.Add(rbCargo); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1009"), panelAirlinerType)); airlineType = Route.RouteType.Passenger; WrapPanel panelAirlineLogo = new WrapPanel(); imgLogo = new Image(); imgLogo.Source = new BitmapImage(new Uri(logoPath, UriKind.RelativeOrAbsolute)); imgLogo.Width = 32; imgLogo.Margin = new Thickness(0, 0, 5, 0); imgLogo.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; RenderOptions.SetBitmapScalingMode(imgLogo, BitmapScalingMode.HighQuality); panelAirlineLogo.Children.Add(imgLogo); Button btnLogo = new Button(); btnLogo.Content = "..."; btnLogo.Background = Brushes.Transparent; btnLogo.Click += new RoutedEventHandler(btnLogo_Click); btnLogo.Margin = new Thickness(5, 0, 0, 0); panelAirlineLogo.Children.Add(btnLogo); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1003"), panelAirlineLogo)); cbColor = new ComboBox(); cbColor.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbColor.Width = 250; cbColor.ItemTemplate = this.Resources["ColorItem"] as DataTemplate; foreach (PropertyInfo c in typeof(Colors).GetProperties()) { cbColor.Items.Add(c); if (c.Name == GameObject.GetInstance().MainAirline.Profile.Color) { cbColor.SelectedItem = c; } } lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1004"), cbColor)); cbAirport = new ComboBox(); cbAirport.SetResourceReference(ComboBox.ItemTemplateProperty, "AirportCountryItem"); cbAirport.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); foreach (Airport airport in GameObject.GetInstance().MainAirline.Airports.FindAll(a => a.Terminals.getFreeGates() > 0)) { cbAirport.Items.Add(airport); } cbAirport.SelectedIndex = 0; lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1005"), cbAirport)); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpNewSubsidiary", "1006"), createMoneySlider())); mainPanel.Children.Add(createButtonsPanel()); this.Content = mainPanel; }