public Button RenderDeskChellAsButton() { if (Button == null) { Button = new Button(); Button.Click += Click; Button.Style = (Style)((MainWindow)Application.Current.MainWindow)?.FindResource("ButtonWithoutHoverEffect"); } Button.Name = "button_" + _position.Get_column() + "_" + _position.Get_row(); if (_desk.Get_selectedCell() == this) { if (Checker == null) { Button.Background = ActiveButtonColor; } else { Button.Background = !Checker.IsQuean ? ActiveCheckerColor : ActiveKingCheckerColor; } } else { Button.Background = _desk.AllowedPositions.Contains(GetCellPosition()) ? AllowedPositionColor : _color.Get_color(); } if (Checker == null) { Button.Foreground = null; Button.Content = ""; } else { // Button.Foreground = Checker.Get_image(); // Button.Content = "***" + Environment.NewLine + "***"; Button.Content = ConstructStackPanel(Checker.Get_image()); if (Checker.IsShotDown) { Button.Background = Brushes.Green; } } if (_desk.BattleCheckersPositions.Contains(_position)) { Button.Background = Brushes.Red; } return(Button); }
public Cell GetCell(CellPosition position) => Cells[position.Get_row() * Width + position.Get_column()];