Exemplo n.º 1
0
 public void ToggleCells(LightsOutCell clickedCell)
 {
     int row = clickedCell.Row, column = clickedCell.Column;
     //self
     clickedCell.Toggle();
     //up
     if (row - 1 >= 0)
         cellMatrix[row - 1, column].Toggle();
     //down
     if (row + 1 < Rows)
         cellMatrix[row + 1, column].Toggle();
     //left
     if (column - 1 >= 0)
         cellMatrix[row, column - 1].Toggle();
     //right
     if (column + 1 < Columns)
         cellMatrix[row, column + 1].Toggle();
 }
Exemplo n.º 2
0
 private void InitializeCells()
 {
     for (var r = 0; r < Rows; r++)
         for (var c = 0; c < Columns; c++) {
             var cell = new LightsOutCell(r, c);
             Cells.Add(cell);
             cellMatrix[r, c] = cell;
         }
 }
 private void PushUndoCell(LightsOutCell cell)
 {
     undoStack.Push(cell);
     OnPropertyChanged("CanUndo");
 }