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
        }
예제 #2
0
        public AirlinerFacilityMVVM(AirlinerFacility.FacilityType type, AirlinerClassMVVM airlinerClass)
        {
            this.Facilities = new ObservableCollection <AirlinerFacility>();

            this.AirlinerClass = airlinerClass;
            this.Type          = type;
        }
예제 #3
0
        public static object ShowPopUp(AirlinerClass airlinerClass, AirlinerFacility.FacilityType type)
        {
            PopUpWindow window = new PopUpAirlinerFacility(airlinerClass, type);

            window.ShowDialog();

            return(window.Selected == null ? null : window.Selected);
        }
예제 #4
0
 //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>());
     }
 }
예제 #5
0
 // 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);
     }
 }
예제 #6
0
 //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);
     }
 }
예제 #7
0
        //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>());
            }
        }
예제 #8
0
        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>();
 }
예제 #10
0
 //returns the basic facility for a specific type
 public static AirlinerFacility GetBasicFacility(AirlinerFacility.FacilityType type)
 {
     return(facilities[type][0]);
 }
예제 #11
0
 //returns the current facility for a facility type
 public AirlinerFacility getFacility(AirlinerFacility.FacilityType type)
 {
     return(this.Facilities[type]);
 }
예제 #12
0
 //returns the facility of a specific type
 public AirlinerFacility getFacility(AirlinerFacility.FacilityType type)
 {
     return(this.Facilities.Find(f => f.Type == type));
 }