public void createGrid(PuzzleArgs args)
        {
            /* Clear all the grid from prev elements */
            this.BaseGrid.Children.Clear();
            this.BaseGrid.RowDefinitions.Clear();
            this.BaseGrid.ColumnDefinitions.Clear();

            this.vm.setMazeValues(args);
            int   rows  = args.Rows;
            int   cols  = args.Cols;
            Level level = args.Level;

            for (int b = 0; b < rows; ++b)
            {
                RowDefinition r = new RowDefinition();
                this.BaseGrid.RowDefinitions.Add(r);
                r.Height = new GridLength(1, GridUnitType.Star);
            }

            for (int a = 0; a < cols; ++a)
            {
                ColumnDefinition c = new ColumnDefinition();
                this.BaseGrid.ColumnDefinitions.Add(c);
                c.Width = new GridLength(1, GridUnitType.Star);
            }

            createLabels();
        }
 public void setMazeValues(PuzzleArgs args)
 {
     VM_row   = args.Rows;
     VM_col   = args.Cols;
     VM_level = args.Level;
     this.model.generateMaze();
 }
예제 #3
0
 public MyTileGenerator(PuzzleArgs args)
 {
     this.rows    = args.Rows;
     this.cols    = args.Cols;
     this.level   = args.Level;
     this.arr     = new Tile[rows, cols];
     this.tracker = new PuzzleProgressTracker(this.arr);
     TilesMoved  += this.tracker.updateProgress;
 }
예제 #4
0
        private void generatePuzzleFromAppConfig()
        {
            int    rows  = int.Parse(ConfigurationManager.AppSettings["Rows"]);
            int    cols  = int.Parse(ConfigurationManager.AppSettings["Cols"]);
            string level = ConfigurationManager.AppSettings["Level"];

            PuzzleArgs args = new PuzzleArgs(rows, cols, LevelClass.getLevelFromString(level));

            puzzle.createGrid(args);
        }