private void btnLoad_Click(object sender, RoutedEventArgs e) { ComboBox cbConfigurations = new ComboBox(); cbConfigurations.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbConfigurations.SelectedValuePath = "Name"; cbConfigurations.DisplayMemberPath = "Name"; cbConfigurations.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; cbConfigurations.Width = 200; foreach (RouteClassesConfiguration confItem in Configurations.GetConfigurations(Configuration.ConfigurationType.Routeclasses)) { cbConfigurations.Items.Add(confItem); } cbConfigurations.SelectedIndex = 0; if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PageAirlineWages", "1013"), cbConfigurations) == PopUpSingleElement.ButtonSelected.OK && cbConfigurations.SelectedItem != null) { RouteClassesConfiguration configuration = (RouteClassesConfiguration)cbConfigurations.SelectedItem; foreach (RouteClassConfiguration classConfiguration in configuration.getClasses()) { foreach (RouteFacility facility in classConfiguration.getFacilities()) { ComboBox cbFacility = cbFacilities[classConfiguration.Type].Find(cb => ((RouteFacility)cb.SelectedItem).Type == facility.Type); if (GameObject.GetInstance().GameTime.Year >= (int)facility.Type) { cbFacility.SelectedItem = facility; } } } } }
private void btnLoad_Click(object sender, RoutedEventArgs e) { ComboBox cbConfigurations = new ComboBox(); cbConfigurations.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbConfigurations.SelectedValuePath = "Name"; cbConfigurations.DisplayMemberPath = "Name"; cbConfigurations.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; cbConfigurations.Width = 200; foreach (RouteClassesConfiguration confItem in Configurations.GetConfigurations(Configuration.ConfigurationType.Routeclasses)) { cbConfigurations.Items.Add(confItem); } cbConfigurations.SelectedIndex = 0; if (PopUpSingleElement.ShowPopUp("Select configuration", cbConfigurations) == PopUpSingleElement.ButtonSelected.OK && cbConfigurations.SelectedItem != null) { RouteClassesConfiguration configuration = (RouteClassesConfiguration)cbConfigurations.SelectedItem; foreach (RouteClassConfiguration classConfiguration in configuration.getClasses()) { foreach (Route route in this.Classes.Keys) { foreach (RouteFacility facility in classConfiguration.getFacilities()) { this.Classes[route][classConfiguration.Type].addFacility(facility); } } } } }
private void btnLoadConfiguration_Click(object sender, RoutedEventArgs e) { ComboBox cbConfigurations = new ComboBox(); cbConfigurations.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbConfigurations.SelectedValuePath = "Name"; cbConfigurations.DisplayMemberPath = "Name"; cbConfigurations.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; cbConfigurations.Width = 200; foreach (RouteClassesConfiguration confItem in Configurations.GetConfigurations(Configuration.ConfigurationType.Routeclasses)) { cbConfigurations.Items.Add(confItem); } cbConfigurations.SelectedIndex = 0; if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PageAirlineWages", "1013"), cbConfigurations) == PopUpSingleElement.ButtonSelected.OK && cbConfigurations.SelectedItem != null) { foreach (AirlineClassMVVM rClass in this.Classes) { foreach (AirlineClassFacilityMVVM rFacility in rClass.Facilities) { rFacility.SelectedFacility = RouteFacilities.GetBasicFacility(rFacility.Type);//GetFacilities(rFacility.Type).OrderBy(f => f.ServiceLevel).First(); } } RouteClassesConfiguration configuration = (RouteClassesConfiguration)cbConfigurations.SelectedItem; foreach (RouteClassConfiguration classConfiguration in configuration.getClasses()) { foreach (RouteFacility facility in classConfiguration.getFacilities()) { AirlineClassMVVM aClass = this.Classes.Where(c => c.Type == classConfiguration.Type).FirstOrDefault(); if (aClass != null) { AirlineClassFacilityMVVM aFacility = aClass.Facilities.Where(f => f.Type == facility.Type).FirstOrDefault(); if (aFacility != null) { aFacility.SelectedFacility = facility; } } } } btnSave.Visibility = System.Windows.Visibility.Visible; } }
//sets up an scenario airline route private static void SetupScenarioRoute(ScenarioAirlineRoute saroute, Airline airline) { SetupScenarioAirport(airline, saroute.Destination1, saroute.Quantity); SetupScenarioAirport(airline, saroute.Destination2, saroute.Quantity); double price = PassengerHelpers.GetPassengerPrice(saroute.Destination1, saroute.Destination2); for (int i = 0; i < saroute.Quantity; i++) { Guid id = Guid.NewGuid(); PassengerRoute route = new PassengerRoute(id.ToString(), saroute.Destination1, saroute.Destination2, price); RouteClassesConfiguration configuration = AIHelpers.GetRouteConfiguration(route); foreach (RouteClassConfiguration classConfiguration in configuration.getClasses()) { route.getRouteAirlinerClass(classConfiguration.Type).FarePrice = price * GeneralHelpers.ClassToPriceFactor(classConfiguration.Type); foreach (RouteFacility rfacility in classConfiguration.getFacilities()) { route.getRouteAirlinerClass(classConfiguration.Type).addFacility(rfacility); } } airline.addRoute(route); FleetAirliner fAirliner = AirlineHelpers.CreateAirliner(airline, saroute.AirlinerType); airline.addAirliner(fAirliner); fAirliner.addRoute(route); AIHelpers.CreateRouteTimeTable(route, fAirliner); fAirliner.Status = FleetAirliner.AirlinerStatus.To_route_start; AirlineHelpers.HireAirlinerPilots(fAirliner); route.LastUpdated = GameObject.GetInstance().GameTime; } }
private void btnLoadConfiguration_Click(object sender, RoutedEventArgs e) { ComboBox cbConfigurations = new ComboBox(); cbConfigurations.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbConfigurations.SelectedValuePath = "Name"; cbConfigurations.DisplayMemberPath = "Name"; cbConfigurations.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; cbConfigurations.Width = 200; foreach (RouteClassesConfiguration confItem in Configurations.GetConfigurations(Configuration.ConfigurationType.Routeclasses)) { cbConfigurations.Items.Add(confItem); } cbConfigurations.SelectedIndex = 0; if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PageCreateRoute", "1012"), cbConfigurations) == PopUpSingleElement.ButtonSelected.OK && cbConfigurations.SelectedItem != null) { RouteClassesConfiguration configuration = (RouteClassesConfiguration)cbConfigurations.SelectedItem; foreach (RouteClassConfiguration classConfiguration in configuration.getClasses()) { MVVMRouteClass rClass = this.Classes.Find(c => c.Type == classConfiguration.Type); if (rClass != null) { foreach (RouteFacility facility in classConfiguration.getFacilities()) { MVVMRouteFacility rFacility = rClass.Facilities.Find(f => f.Type == facility.Type); if (rFacility != null) { rFacility.SelectedFacility = facility; } } } } } }