예제 #1
0
 public CellViewModel(Cell cell, int i)
 {
     this.cell = cell;
     cell.PropertyChanged += cell_PropertyChanged;
     State = cell.Open ? "Open" : "Hide";
     NeighborMineCount = cell.NeighborMineCount;
     this.index = i;
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
 public new void Dispose()
 {
     base.Dispose();
     if (cell != null)
     {
         cell.PropertyChanged -= cell_PropertyChanged;
         cell = null;
     }
 }