private void UpdateBrushes() { Brush bg = Brushes.Transparent; var fg = bg; if (_cell != null && _model != null) { if (_cell.Owner != null) { switch (_cell.State) { case ECellState.Base: fg = ColorToKlopBrushConverter.GetBrush(_cell.Owner.Color, false); bg = Brushes.Gray; break; case ECellState.Alive: fg = ColorToKlopBrushConverter.GetBrush(_cell.Owner.Color, false); break; case ECellState.Dead: fg = ColorToKlopBrushConverter.GetBrush(_cell.Owner.Color, true); break; } } if (_cell.Available && _model.Model.CurrentPlayer.Human) { bg = AvailableBrush; } if (_highlighted > 0) { bg = _highlighted > _model.Model.RemainingKlops ? HoverUnavailableBrush : HoverBrush; Cursor = Cursors.Hand; } else { Cursor = Cursors.Arrow; } } if (fg != Foreground) { Foreground = fg; } if (bg != Background) { Background = bg; } }
private void UpdateBrushes() { if (Cell == null) { return; } Brush bg = Brushes.Transparent; var fg = bg; switch (Cell.State) { case ECellState.Base: fg = ColorToKlopBrushConverter.GetBrush(Cell.Owner.Color, false); bg = Brushes.Gray; break; case ECellState.Alive: fg = ColorToKlopBrushConverter.GetBrush(Cell.Owner.Color, false); break; case ECellState.Dead: fg = ColorToKlopBrushConverter.GetBrush(Cell.Owner.Color, true); break; } if (fg != Foreground) { Foreground = fg; } if (bg != Background) { Background = bg; } }