Beispiel #1
0
        private void B1_Click(object sender, RoutedEventArgs e)
        {
            if (s == "")
            {
                try
                {
                    s = B1.Content.ToString();
                }
                catch (Exception)
                {
                }

                B1.Content = "";
                clr        = B1.Foreground;
            }
            else
            {
                if (s == "♙" & (clr == Brushes.Black))
                {
                    var pawnp = new PawnPromotion(); pawnp.ShowDialog(); switch (pawnp.P)
                    {
                    case PawnPromotion.Piece.Queen: s = "♕"; break;

                    case PawnPromotion.Piece.Castle: s = "♖"; break;

                    case PawnPromotion.Piece.Bishop: s = "♗"; break;

                    case PawnPromotion.Piece.Horse: s = "♘"; break;
                    }
                }
                B1.Content    = s;
                B1.Foreground = clr;
                s             = "";
            }
        }
        private void F1_Click(object sender, RoutedEventArgs e)
        {
            if (s == "")
            {
                try
                {
                    s = F1.Content.ToString();
                }
                catch (Exception)
                {

                }

                F1.Content = "";
                clr = F1.Foreground;
            }
            else
            {
                if (s == "♙" & (clr == Brushes.Black)) { var pawnp = new PawnPromotion(); pawnp.ShowDialog(); switch (pawnp.P) { case PawnPromotion.Piece.Queen:s = "♕"; break; case PawnPromotion.Piece.Castle:s = "♖"; break; case PawnPromotion.Piece.Bishop:s = "♗"; break; case PawnPromotion.Piece.Horse:s = "♘"; break; } }
                F1.Content = s;
                F1.Foreground = clr;
                s = "";
            }
        }