コード例 #1
0
        /// <summary>
        /// Initialize this viewModel
        /// </summary>
        public void Initialize(DrawService drawService)
        {
            //initialize draw service
            _drawService = drawService;
            //_drawService.OnClick += OnClick;

            //create empty voronoi Diagram
            _points         = new List <Point>();
            _voronoiDiagram = new VoronoiDiagram();
            _cityData       = new CityData();

            _citySettings = new CitySettings();

            //seed for random generation
            Seed = DateTime.Now.GetHashCode();

            //store default settings
            foreach (var districtType in _districtTypes)
            {
                DistrictSettings.Add(new DistrictSettings(districtType));
                break;
            }

            RaisePropertyChanged("DistrictSettings");

            //debug for math test and drawing
            MathTesting();
        }
コード例 #2
0
        private void AddNewCityDistrictType(string settings)
        {
            foreach (var dis in DistrictSettings)
            {
                if (dis.Type == settings)
                {
                    return;
                }
            }

            _districtColors.Add(Extensions.Extensions.RandomColor());

            DistrictSettings.Add(new DistrictSettings(settings));
            //RaisePropertyChanged("DistrictSettings");
        }