private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            currentPoint = new Point();

            // Default Werte
            int    SizeX    = 50;
            int    SizeY    = 50;
            double cellSize = 10d;

            NewPlaygroundDialog dialog = new NewPlaygroundDialog();

            if (dialog.ShowDialog() == true)
            {
                SizeX    = dialog.SizeX;
                SizeY    = dialog.SizeY;
                cellSize = dialog.CellSize;
            }

            Playground playground = new Playground(SizeX, SizeY);

            _viewModel = new MainViewModel(playground, cellSize);
            _viewModel.PlaygroundChanged += DefinePlaygroundGrid;

            DefinePlaygroundGrid(playground, _viewModel.CellSize);
            DataContext = _viewModel;
        }
Exemple #2
0
        private void CreateNewPlayground()
        {
            Generation = 0;
            StopCommand.Execute(null);
            ClearCommand.Execute(null);

            NewPlaygroundDialog dialog = new NewPlaygroundDialog();

            if (dialog.ShowDialog() == true)
            {
                int SizeX = dialog.SizeX;
                int SizeY = dialog.SizeY;
                CellSize = dialog.CellSize;

                playground = new Playground(SizeX, SizeY);
                PlaygroundChanged?.Invoke(playground, CellSize);

                SoftwareName = string.Format("Conway's Game of Life: Neu {0}x{1}", playground.SizeX, playground.SizeY, filename);
            }
        }