public PageStartDataViewModel(AppState state, IRegionManager regionManager)
        {
            _state = state;
            _regionManager = regionManager;

            _allRegions = new Region {Name = "All Regions", Id = 100};

            var continents = from continent in _state.Context.Continents
                orderby continent.Id descending
                select continent;
            Continents = new ObservableCollection<Continent>(continents.ToList());

            _regions = from region in _state.Context.Regions select region;
            Regions = new ObservableCollection<Region>(_regions.ToList());
            Regions.Insert(0, _allRegions);
            SelectedRegion = _allRegions;

            MajorAirports = false;
            RandomOpponents = true;
            RealData = false;
            GameTurn = true;
            PausedOnStart = false;
            SameRegion = true;

            // Use Enumerable.Range to create lists for years and opponents.
            NumOpponents = Enumerable.Range(1, 51).ToList();

            var start = new DateTime(1960, 1, 1);
            var end = DateTime.Now;

            Years = Enumerable.Range(start.Year, (end.Year - start.Year) + 1).OrderByDescending(i => i).ToList();

            var difficulties = from difficulty in _state.Context.Difficulties select difficulty;
            Difficulties = new ObservableCollection<Difficulty>(difficulties.ToList());

            // DelegateCommand only works with Nullable objects hence the int?.
            ChangeRegions = new DelegateCommand<Continent>(UpdateRegions);
            NavigateCommand = new DelegateCommand<Uri>(ChangePages);
        }
Ejemplo n.º 2
0
 //returns the list of countries from a region
 public static List<Country> GetCountries(Region region)
 {
     return GetCountries().FindAll((country => country.Region == region));
 }
Ejemplo n.º 3
0
 public TerritoryCountry(
     string section,
     string uid,
     string shortName,
     Region region,
     string tailNumberFormat,
     Country mainCountry)
     : base(section, uid, shortName, region, tailNumberFormat)
 {
     MainCountry = mainCountry;
 }
Ejemplo n.º 4
0
 public Country(string section, string uid, string shortName, Region region, string tailNumberFormat)
     : base(uid, shortName)
 {
     Section = section;
     Region = region;
     TailNumberFormat = tailNumberFormat;
     //TailNumbers = new CountryTailNumber(this);
     //Currencies = new List<CountryCurrency>();
 }
Ejemplo n.º 5
0
 //returns all airlines
 //returns all airlines for a specific region
 public static List<Airline> GetAirlines(Region region)
 {
     return airlines.FindAll(a => a.Profile.Country.Region == region);
 }
 public static double GetFuelPrice(Region region)
 {
     return region.FuelIndex*GameObject.GetInstance().FuelPrice;
 }
Ejemplo n.º 7
0
 //returns all airports from a specific region
 public static List<Airport> GetAirports(Region region)
 {
     return GetAirports(airport => airport.Profile.Country.Region == region);
 }
Ejemplo n.º 8
0
 public static void AddRegion(Region region)
 {
     _regions.Add(region);
 }
Ejemplo n.º 9
0
 //returns the continent for a region
 public static Continent GetContinent(Region region)
 {
     return continents.First(c => c.Regions.Exists(r => r.Uid == region.Uid));
 }
Ejemplo n.º 10
0
 //returns if a country contains a region
 public bool HasRegion(Region region)
 {
     return Regions.Contains(region);
 }
Ejemplo n.º 11
0
 //adds a region to the continent
 public void AddRegion(Region region)
 {
     Regions.Add(region);
 }