private void changeState(cell sender) { SolidColorBrush newBrush = new SolidColorBrush(); if (sender.state == 0) { newBrush.Color = Windows.UI.Colors.DimGray; } else { newBrush.Color = Windows.UI.Colors.White; } sender.body.Fill = newBrush; }
private void initGrid(bool state) { int wCount, hCount; wCount = (int)(this.Board.ActualWidth + this.size) / size; hCount = (int)(this.Board.ActualHeight + this.size) / size; for (int i = 0; i < hCount; i++) { List <cell> holder = new List <cell>(); for (var j = 0; j < wCount; j++) { cell newCell = new cell(size, state); newCell.stateChaged += new cell.stateChagedHandler(changeState); holder.Add(newCell); } this.grid.Add(holder); } }