public PopUpAirlinerFacility(AirlinerClass airlinerClass, AirlinerFacility.FacilityType type) { InitializeComponent(); this.AirlinerClass = airlinerClass; this.Type = type; this.Title = "Select " + type.ToString().ToLower(); this.Width = 400; this.Height = 120; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; StackPanel mainPanel = new StackPanel(); mainPanel.Margin = new Thickness(10, 10, 10, 10); cbFacility = new ComboBox(); cbFacility.ItemTemplate = this.Resources["AirlinerFacilityItem"] as DataTemplate; cbFacility.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); foreach (AirlinerFacility facility in AirlinerFacilities.GetFacilities(this.Type,GameObject.GetInstance().GameTime.Year)) cbFacility.Items.Add(facility); cbFacility.SelectedItem = this.AirlinerClass.getFacility(this.Type); mainPanel.Children.Add(cbFacility); mainPanel.Children.Add(createButtonsPanel()); this.Content = mainPanel; // int serviceLevel, double percentOfSeats, double pricePerSeat }
public AirlinerFacilityMVVM(AirlinerFacility.FacilityType type, AirlinerClassMVVM airlinerClass) { this.Facilities = new ObservableCollection <AirlinerFacility>(); this.AirlinerClass = airlinerClass; this.Type = type; }
public static object ShowPopUp(AirlinerClass airlinerClass, AirlinerFacility.FacilityType type) { PopUpWindow window = new PopUpAirlinerFacility(airlinerClass, type); window.ShowDialog(); return(window.Selected == null ? null : window.Selected); }
//returns the list of facilities for a specific type public static List <AirlinerFacility> GetFacilities(AirlinerFacility.FacilityType type) { if (facilities.ContainsKey(type)) { return(facilities[type]); } else { return(new List <AirlinerFacility>()); } }
// chs, 2011-13-10 added function to return a specific airliner facility //returns a facility based on name and type public static AirlinerFacility GetFacility(AirlinerFacility.FacilityType type, string uid) { if (GetFacilities(type).Count > 0) { return(GetFacilities(type).Find((delegate(AirlinerFacility f) { return f.Uid == uid; }))); } else { return(null); } }
//returns the current facility for a facility type public AirlinerFacility getFacility(AirlinerFacility.FacilityType type) { if (this.Facilities.ContainsKey(type)) { return(this.Facilities[type]); } else { return(null); } }
//returns the list of facilities for a specific type after a specific year public static List <AirlinerFacility> GetFacilities(AirlinerFacility.FacilityType type, int year) { if (facilities.ContainsKey(type)) { return(facilities[type].FindAll((delegate(AirlinerFacility f) { return f.FromYear <= year; }))); } else { return(new List <AirlinerFacility>()); } }
public PopUpAirlinerFacility(AirlinerClass airlinerClass, AirlinerFacility.FacilityType type) { InitializeComponent(); this.AirlinerClass = airlinerClass; this.Type = type; this.Title = "Select " + type.ToString().ToLower(); this.Width = 400; this.Height = 120; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; StackPanel mainPanel = new StackPanel(); mainPanel.Margin = new Thickness(10, 10, 10, 10); cbFacility = new ComboBox(); cbFacility.ItemTemplate = this.Resources["AirlinerFacilityItem"] as DataTemplate; cbFacility.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); foreach (AirlinerFacility facility in AirlinerFacilities.GetFacilities(this.Type, GameObject.GetInstance().GameTime.Year)) { cbFacility.Items.Add(facility); } cbFacility.SelectedItem = this.AirlinerClass.getFacility(this.Type); mainPanel.Children.Add(cbFacility); mainPanel.Children.Add(createButtonsPanel()); this.Content = mainPanel; // int serviceLevel, double percentOfSeats, double pricePerSeat }
public AirlinerClassFacilityMVVM(AirlinerFacility.FacilityType type) { this.Type = type; this.Facilities = new List <AirlinerFacility>(); }
//returns the basic facility for a specific type public static AirlinerFacility GetBasicFacility(AirlinerFacility.FacilityType type) { return(facilities[type][0]); }
//returns the current facility for a facility type public AirlinerFacility getFacility(AirlinerFacility.FacilityType type) { return(this.Facilities[type]); }
//returns the facility of a specific type public AirlinerFacility getFacility(AirlinerFacility.FacilityType type) { return(this.Facilities.Find(f => f.Type == type)); }