Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Researcher"/> class.
        /// </summary>
        /// <param name="maze">The maze.</param>
        /// <param name="probanden">The probanden.</param>
        /// <remarks></remarks>
        public Researcher(Maze4 maze, IEnumerable<Proband> probanden)
        {
            Contract.Requires(maze != null, "Labyrinth darf nicht null sein");
            Contract.Requires(probanden != null, "Elementliste darf nicht null sein");

            Maze = maze;
            _probanden = new List<Proband>(probanden);

            WorkerReportsProgress = true;
            WorkerSupportsCancellation = true;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MazeEventArgs"/> class.
 /// </summary>
 /// <param name="maze">The maze.</param>
 /// <remarks></remarks>
 public MazeEventArgs(Maze4 maze)
 {
     Maze = maze;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Setzt das anzuzeigende Labyrinth
        /// </summary>
        /// <param name="maze"></param>
        public void SetMaze(Maze4 maze)
        {
            Contract.Requires(maze != null);

            lock (_lockObject)
            {
                _sourceCellX = null;
                _sourceCellY = null;
                _deadEnds.Clear();

                // Altes Binding entfernen
                if (Maze != null) Maze.MazeChanged -= OnMazeChanged;

                // Neu setzen
                Maze = maze;
                maze.MazeChanged += OnMazeChanged;
                RecalculateBlockSizes();
            }
            Invalidate();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Regenerates the maze.
        /// </summary>
        /// <remarks></remarks>
        public void RegenerateMaze()
        {
            Maze = new Maze4(MazeGenerator);
            Maze.MazeChanged += MazeMazeChanged;
            Maze.GenerateNew(MazeDimension.Item1, MazeDimension.Item2);

            // Aktualisieren
            if (_panel.InvokeRequired) _panel.Invoke((MethodInvoker)delegate
                                                                        {
                                                                            _panel.SetMaze(Maze);
                                                                            _panel.SetStartingPoint(0, 0);
                                                                        });
            else
            {
                _panel.SetMaze(Maze);
                _panel.SetStartingPoint(0, 0);
            }
        }