// chs, 2011-14-10 added functions for airline advertisement //sets an Advertisement to the airline public void setAirlineAdvertisement(AdvertisementType type) { if (!this.Advertisements.ContainsKey(type.Type)) { this.Advertisements.Add(type.Type, type); } else { this.Advertisements[type.Type] = type; } }
/*!adds a type to the list * */ public static void AddAdvertisementType(AdvertisementType type) { types.Add(type); }
// chs, 2011-14-10 added functions for airline advertisement //sets an Advertisement to the airline public void setAirlineAdvertisement(AdvertisementType type) { if (!this.Advertisements.ContainsKey(type.Type)) this.Advertisements.Add(type.Type, type); else this.Advertisements[type.Type] = type; }
//returns the advertisement for the airline for a specific type public AdvertisementType getAirlineAdvertisement(AdvertisementType.AirlineAdvertisementType type) { return this.Advertisements[type]; }
//creates an item for an advertisering type private UIElement createAdvertisementTypeItem(AdvertisementType.AirlineAdvertisementType type) { if (this.Airline.IsHuman) { ComboBox cbType = new ComboBox(); cbType.ItemTemplate = this.Resources["AdvertisementItem"] as DataTemplate; cbType.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbType.Width = 200; cbAdvertisements.Add(type, cbType); foreach (AdvertisementType aType in AdvertisementTypes.GetTypes(type)) cbType.Items.Add(aType); cbType.SelectedItem = this.Airline.getAirlineAdvertisement(type); return cbType; } // chs, 2011-17-10 changed so it is not possible to change the advertisement type for a CPU airline else { return UICreator.CreateTextBlock(this.Airline.getAirlineAdvertisement(type).Name); } }
public AirlineAdvertisementMVVM(AdvertisementType.AirlineAdvertisementType type) { this.Type = type; }
/*!returns the basic advertisement */ public static AdvertisementType GetBasicType(AdvertisementType.AirlineAdvertisementType type) { return GetTypes(type).Find((delegate(AdvertisementType t) { return t.ReputationLevel == 0; })); }
/*!returns the advertisement types for a specific type */ public static List<AdvertisementType> GetTypes(AdvertisementType.AirlineAdvertisementType type) { return types.FindAll((delegate(AdvertisementType t) { return t.Type == type; })); }
/*!returns the advertisement type for a specific type with a name */ public static AdvertisementType GetType(AdvertisementType.AirlineAdvertisementType type, string name) { return GetTypes(type).Find((delegate(AdvertisementType t) { return t.Name == name; })); }