public PopUpSelectOpponents(Airline human, int opponents, int startyear, Region region, Continent continent) { this.Human = human; this.Opponents = opponents; this.StartYear = startyear; InitializeComponent(); this.Uid = "1000"; this.Title = Translator.GetInstance().GetString("PopUpSelectOpponents", this.Uid); this.Width = 500; this.Height = 500; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; StackPanel panelMain = new StackPanel(); Grid grdMain = UICreator.CreateGrid(2); panelMain.Children.Add(grdMain); StackPanel panelSelectAirlines = new StackPanel(); panelSelectAirlines.Margin = new Thickness(5, 0, 5, 0); TextBlock txtSelectedHeader = new TextBlock(); txtSelectedHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtSelectedHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush"); txtSelectedHeader.FontWeight = FontWeights.Bold; txtSelectedHeader.Uid = "1001"; txtSelectedHeader.Text = string.Format(Translator.GetInstance().GetString("PopUpSelectOpponents", txtSelectedHeader.Uid),this.Opponents); panelSelectAirlines.Children.Add(txtSelectedHeader); lbSelectedAirlines = new ListBox(); lbSelectedAirlines.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbSelectedAirlines.SetResourceReference(ListBox.ItemTemplateProperty, "AirlineLogoItem"); lbSelectedAirlines.MaxHeight = 400; lbSelectedAirlines.SelectionChanged += lbSelectedAirlines_SelectionChanged; panelSelectAirlines.Children.Add(lbSelectedAirlines); Grid.SetColumn(panelSelectAirlines, 0); grdMain.Children.Add(panelSelectAirlines); StackPanel panelOpponents = new StackPanel(); panelOpponents.Margin = new Thickness(5, 0, 5, 0); TextBlock txtOpponentsHeader = new TextBlock(); txtOpponentsHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; txtOpponentsHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush"); txtOpponentsHeader.FontWeight = FontWeights.Bold; txtOpponentsHeader.Uid = "1002"; txtOpponentsHeader.Text = Translator.GetInstance().GetString("PopUpSelectOpponents", txtOpponentsHeader.Uid); panelOpponents.Children.Add(txtOpponentsHeader); lbOpponentAirlines = new ListBox(); lbOpponentAirlines.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbOpponentAirlines.SetResourceReference(ListBox.ItemTemplateProperty, "AirlineLogoItem"); lbOpponentAirlines.MaxHeight = 400; lbOpponentAirlines.SelectionChanged += lbOpponentAirlines_SelectionChanged; panelOpponents.Children.Add(lbOpponentAirlines); foreach (Airline airline in Airlines.GetAirlines(a => a.Profile.Founded <= startyear && a.Profile.Folded > startyear && a != this.Human && (a.Profile.Country.Region == region || (continent != null && (continent.Uid == "100" || continent.hasRegion(a.Profile.Country.Region)))))) lbOpponentAirlines.Items.Add(airline); Grid.SetColumn(panelOpponents, 1); grdMain.Children.Add(panelOpponents); Button btnOk = new Button(); btnOk.Uid = "100"; btnOk.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnOk.Height = Double.NaN; btnOk.Width = Double.NaN; btnOk.Content = Translator.GetInstance().GetString("General", btnOk.Uid); btnOk.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; btnOk.Margin = new Thickness(5, 5, 0, 0); btnOk.Click += btnOk_Click; btnOk.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); panelMain.Children.Add(btnOk); this.Content = panelMain; }
//adds a region to the list public static void AddRegion(Region region) { regions.Add(region); }
public static object ShowPopUp(Airline human, int opponents, int startyear, Region region, Continent continent = null) { PopUpWindow window = new PopUpSelectOpponents(human, opponents, startyear,region,continent); window.ShowDialog(); return window.Selected; }
//returns all airports from a specific region public static List<Airport> GetAirports(Region region) { return GetAirports(delegate(Airport airport) { return airport.Profile.Country.Region == region; }); }
//returns all airlines for a specific region public static List<Airline> GetAirlines(Region region) { return airlines.FindAll(a => a.Profile.Country.Region == region); }
//returns the list of countries from a region public static List<Country> GetCountries(Region region) { return GetCountries().FindAll((delegate(Country country) { return country.Region == region; })); }
public TerritoryCountry(string section, string uid, string shortName, Region region, string tailNumberFormat, Country mainCountry) : base(section,uid,shortName,region,tailNumberFormat) { this.MainCountry = mainCountry; }
public Country(string section, string uid, string shortName, Region region, string tailNumberFormat) : base(uid,shortName) { Country.Section = section; this.Region = region; this.TailNumberFormat = tailNumberFormat; this.TailNumbers = new CountryTailNumber(this); this.Currencies = new List<CountryCurrency>(); }