public CellViewModel(Cell cell, int i) { this.cell = cell; cell.PropertyChanged += cell_PropertyChanged; State = cell.Open ? "Open" : "Hide"; NeighborMineCount = cell.NeighborMineCount; this.index = i; }
public MineSweeperModel(int width, int height, int mineCount) { this.Width = width; this.Height = height; this.Cells = new Cell[width * height]; foreach (var i in Enumerable.Range(0, Cells.Length)) Cells[i] = new Cell(); this.MineCount = mineCount < Cells.Length ? mineCount : Cells.Length - 1; candidate = new SolveCellType[Cells.Length]; foreach (var i in Enumerable.Range(0, Cells.Length)) { candidate[i] = SolveCellType.Undef; } }
public new void Dispose() { base.Dispose(); if (cell != null) { cell.PropertyChanged -= cell_PropertyChanged; cell = null; } }