Inheritance: INotifyPropertyChanged
Example #1
0
        public PageCreateRoute()
        {
            this.Classes = new List <MVVMRouteClass>();

            foreach (AirlinerClass.ClassType type in AirlinerClass.GetAirlinerTypes())
            {
                if ((int)type <= GameObject.GetInstance().GameTime.Year)
                {
                    MVVMRouteClass rClass = new MVVMRouteClass(type, RouteAirlinerClass.SeatingType.Reserved_Seating, 1);

                    this.Classes.Add(rClass);
                }
            }

            this.Airports = GameObject.GetInstance().HumanAirline.Airports.OrderByDescending(a => a == GameObject.GetInstance().HumanAirline.Airports[0]).ThenBy(a => a.Profile.Name).ToList();

            AirlinerType dummyAircraft = new AirlinerCargoType(new Manufacturer("Dummy", "", null), "All Aircrafts", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, AirlinerType.BodyType.Single_Aisle, AirlinerType.TypeRange.Regional, AirlinerType.EngineType.Jet, new Period <DateTime>(DateTime.Now, DateTime.Now), 0);

            this.HumanAircrafts = new List <AirlinerType>();

            this.HumanAircrafts.Add(dummyAircraft);


            foreach (AirlinerType type in GameObject.GetInstance().HumanAirline.Fleet.Select(f => f.Airliner.Type).Distinct())
            {
                this.HumanAircrafts.Add(type);
            }

            this.Loaded += PageCreateRoute_Loaded;

            InitializeComponent();
        }
        public PageCreateRoute()
        {
            this.RouteInformationText = "";
            this.ConnectingRoutes = new ObservableCollection<Route>();
            this.Classes = new List<MVVMRouteClass>();

            foreach (AirlinerClass.ClassType type in AirlinerClass.GetAirlinerTypes())
            {
                if ((int)type <= GameObject.GetInstance().GameTime.Year)
                {
                    MVVMRouteClass rClass = new MVVMRouteClass(type, RouteAirlinerClass.SeatingType.Reserved_Seating, 1);

                    this.Classes.Add(rClass);
                }
            }

            this.Airports = GameObject.GetInstance().HumanAirline.Airports.OrderByDescending(a=>a==GameObject.GetInstance().HumanAirline.Airports[0]).ThenBy(a => a.Profile.Country.Name).ThenBy(a=>a.Profile.Name).ToList();

            AirlinerType dummyAircraft = new AirlinerCargoType(new Manufacturer("Dummy", "", null,false), "All Aircrafts", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, AirlinerType.BodyType.Single_Aisle, AirlinerType.TypeRange.Regional, AirlinerType.EngineType.Jet, new Period<DateTime>(DateTime.Now, DateTime.Now), 0,false);

            this.HumanAircrafts = new List<AirlinerType>();

            this.HumanAircrafts.Add(dummyAircraft);

            foreach (AirlinerType type in GameObject.GetInstance().HumanAirline.Fleet.Select(f => f.Airliner.Type).Distinct())
                this.HumanAircrafts.Add(type);

            this.Loaded += PageCreateRoute_Loaded;

            InitializeComponent();
        }
Example #3
0
        public PageShowRoute(Route route)
        {
            this.Classes = new ObservableCollection <MVVMRouteClass>();

            this.Route       = new HumanRouteMVVM(route);
            this.DataContext = this.Route;


            foreach (AirlinerClass.ClassType type in AirlinerClass.GetAirlinerTypes())
            {
                if (this.Route.Route is PassengerRoute)
                {
                    RouteAirlinerClass rClass = ((PassengerRoute)this.Route.Route).getRouteAirlinerClass(type);
                    MVVMRouteClass     mClass = new MVVMRouteClass(type, rClass.Seating, rClass.FarePrice);

                    this.Classes.Add(mClass);
                }
            }


            InitializeComponent();


            this.Loaded += PageShowRoute_Loaded;
        }
        public PageShowRoute(Route route)
        {
            this.Classes = new List<MVVMRouteClass>();

            this.Route = route;
            this.DataContext = this.Route;

            foreach (AirlinerClass.ClassType type in AirlinerClass.GetAirlinerTypes())
            {
                if (this.Route is PassengerRoute)
                {
                   RouteAirlinerClass rClass = ((PassengerRoute)this.Route).getRouteAirlinerClass(type);
                    MVVMRouteClass mClass = new MVVMRouteClass(type, rClass.Seating, rClass.FarePrice);

                    this.Classes.Add(mClass);
                }
            }

            this.Invoices = new List<MonthlyInvoice>();

            foreach (Invoice.InvoiceType type in this.Route.getRouteInvoiceTypes())
                this.Invoices.Add(new MonthlyInvoice(type, 1950, 1, this.Route.getRouteInvoiceAmount(type)));

            this.Legs = new List<Route>();
            this.Legs.Add(this.Route);
            this.Legs.AddRange(this.Route.Stopovers.SelectMany(s => s.Legs));

            InitializeComponent();

            Boolean inRoute = this.Route.getAirliners().Exists(a => a.Status != FleetAirliner.AirlinerStatus.Stopped);

            cbEdit.Visibility = inRoute ? Visibility.Collapsed : System.Windows.Visibility.Visible;

            this.Loaded += PageShowRoute_Loaded;
        }
        public PageCreateRoute()
        {
            this.Classes = new List<MVVMRouteClass>();

            foreach (AirlinerClass.ClassType type in AirlinerClass.GetAirlinerTypes())
            {
                if ((int)type <= GameObject.GetInstance().GameTime.Year)
                {
                    MVVMRouteClass rClass = new MVVMRouteClass(type, RouteAirlinerClass.SeatingType.Reserved_Seating, 1);

                    this.Classes.Add(rClass);
                }
            }

            this.Airports = GameObject.GetInstance().HumanAirline.Airports;

            AirlinerType dummyAircraft = new AirlinerCargoType(new Manufacturer("Dummy", "", null), "All Aircrafts", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, AirlinerType.BodyType.Single_Aisle, AirlinerType.TypeRange.Regional, AirlinerType.EngineType.Jet, new Period<DateTime>(DateTime.Now, DateTime.Now), 0);

            this.HumanAircrafts = new List<AirlinerType>();

            this.HumanAircrafts.Add(dummyAircraft);

            foreach (AirlinerType type in GameObject.GetInstance().HumanAirline.Fleet.Select(f => f.Airliner.Type).Distinct())
                this.HumanAircrafts.Add(type);

            this.Loaded += PageCreateRoute_Loaded;

            InitializeComponent();
        }
        public PageShowRoute(Route route)
        {
            Classes = new ObservableCollection<MVVMRouteClass>();

            Route = new HumanRouteMVVM(route);
            DataContext = Route;

            if (Route.Route.Type == Models.Routes.Route.RouteType.Helicopter)
            {

                 RouteAirlinerClass rClass = ((PassengerRoute)Route.Route).GetRouteAirlinerClass(AirlinerClass.ClassType.EconomyClass);
                 var mClass = new MVVMRouteClass(AirlinerClass.ClassType.EconomyClass, rClass.Seating, rClass.FarePrice);

                 Classes.Add(mClass);

            }
            if (Route.Route.Type == Models.Routes.Route.RouteType.Passenger || Route.Route.Type == Models.Routes.Route.RouteType.Mixed)
            {
                 foreach (AirlinerClass.ClassType cType in AirlinerClass.GetAirlinerTypes())
                {
                    if ((int)cType <= GameObject.GetInstance().GameTime.Year)
                    {
                          RouteAirlinerClass rClass = ((PassengerRoute)Route.Route).GetRouteAirlinerClass(cType);
                          var mClass = new MVVMRouteClass(cType, rClass.Seating, rClass.FarePrice);

                          Classes.Add(mClass);
                    }
                }
            }

            InitializeComponent();

            Loaded += PageShowRoute_Loaded;
        }
Example #7
0
        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;
                            }
                        }
                    }
                }
            }
        }
        public PageShowRoute(Route route)
        {
            this.Classes = new ObservableCollection<MVVMRouteClass>();

            this.Route = new HumanRouteMVVM(route);
            this.DataContext = this.Route;

             foreach (AirlinerClass.ClassType type in AirlinerClass.GetAirlinerTypes())
            {
                if (this.Route.Route is PassengerRoute)
                {
                   RouteAirlinerClass rClass = ((PassengerRoute)this.Route.Route).getRouteAirlinerClass(type);
                    MVVMRouteClass mClass = new MVVMRouteClass(type, rClass.Seating, rClass.FarePrice);

                    this.Classes.Add(mClass);
                }
            }

            InitializeComponent();

            this.Loaded += PageShowRoute_Loaded;
        }
Example #9
0
        public PageShowRoute(Route route)
        {
            this.Classes = new ObservableCollection <MVVMRouteClass>();

            this.Route       = route;
            this.DataContext = this.Route;


            foreach (AirlinerClass.ClassType type in AirlinerClass.GetAirlinerTypes())
            {
                if (this.Route is PassengerRoute)
                {
                    RouteAirlinerClass rClass = ((PassengerRoute)this.Route).getRouteAirlinerClass(type);
                    MVVMRouteClass     mClass = new MVVMRouteClass(type, rClass.Seating, rClass.FarePrice);

                    this.Classes.Add(mClass);
                }
            }

            this.Invoices = new List <MonthlyInvoice>();

            foreach (Invoice.InvoiceType type in this.Route.getRouteInvoiceTypes())
            {
                this.Invoices.Add(new MonthlyInvoice(type, 1950, 1, this.Route.getRouteInvoiceAmount(type)));
            }

            this.Legs = new List <Route>();
            this.Legs.Add(this.Route);
            this.Legs.AddRange(this.Route.Stopovers.SelectMany(s => s.Legs));

            InitializeComponent();

            Boolean inRoute = this.Route.getAirliners().Exists(a => a.Status != FleetAirliner.AirlinerStatus.Stopped);

            cbEdit.Visibility = inRoute ? Visibility.Collapsed : System.Windows.Visibility.Visible;

            this.Loaded += PageShowRoute_Loaded;
        }