Пример #1
0
 public static void AddContinent(Continent continent)
 {
     continents.Add(continent);
 }
Пример #2
0
        /*! creates the time zones.
         */
        /*!creates the continents
         */
        private static void CreateContinents()
        {
            var africa = new Continent("101", "Africa");
            africa.AddRegion(Regions.GetRegion("101"));
            africa.AddRegion(Regions.GetRegion("102"));
            africa.AddRegion(Regions.GetRegion("103"));
            africa.AddRegion(Regions.GetRegion("104"));
            africa.AddRegion(Regions.GetRegion("105"));
            Continents.AddContinent(africa);

            var asia = new Continent("102", "Asia");
            asia.AddRegion(Regions.GetRegion("106"));
            asia.AddRegion(Regions.GetRegion("107"));
            asia.AddRegion(Regions.GetRegion("108"));
            asia.AddRegion(Regions.GetRegion("109"));
            asia.AddRegion(Regions.GetRegion("110"));
            Continents.AddContinent(asia);

            var australia = new Continent("103", "Australia and Oceania");
            australia.AddRegion(Regions.GetRegion("111"));
            australia.AddRegion(Regions.GetRegion("112"));
            Continents.AddContinent(australia);

            var europe = new Continent("104", "Europe");
            europe.AddRegion(Regions.GetRegion("113"));
            europe.AddRegion(Regions.GetRegion("114"));
            europe.AddRegion(Regions.GetRegion("115"));
            europe.AddRegion(Regions.GetRegion("116"));
            Continents.AddContinent(europe);

            var northAmerica = new Continent("105", "North America");
            northAmerica.AddRegion(Regions.GetRegion("117"));
            northAmerica.AddRegion(Regions.GetRegion("118"));
            northAmerica.AddRegion(Regions.GetRegion("119"));
            Continents.AddContinent(northAmerica);

            var southAmerica = new Continent("106", "South America");
            southAmerica.AddRegion(Regions.GetRegion("120"));
            Continents.AddContinent(southAmerica);
        }
        private void UpdateRegions(Continent obj)
        {
            if (obj.Id == 7)
            {
                Regions.Clear();
                Regions.Add(_allRegions);
                foreach (var region in _regions.ToList())
                {
                    Regions.Add(region);
                }
            }
            else
            {
                var continent = from cont in _state.Context.Continents where cont.Id == obj.Id select cont;

                Regions.Clear();
                var regions = continent.First()?.Regions;
                if (regions == null) return;
                Regions.Add(_allRegions);
                foreach (var region in regions)
                {
                    Regions.Add(region);
                }
            }

            SelectedRegion = _allRegions;
        }