public void gameTime_Tick(object sender, EventArgs e) { if (playTime > 0) { playTime--; gameCountDownBeforeStart.Text = playTime.ToString(); if (btnImage1.IsEnabled == false && btnImage2.IsEnabled == false && btnImage3.IsEnabled == false && btnImage4.IsEnabled == false && btnImage5.IsEnabled == false && btnImage6.IsEnabled == false && btnImage7.IsEnabled == false && btnImage8.IsEnabled == false && btnImage9.IsEnabled == false && btnImage10.IsEnabled == false && btnImage11.IsEnabled == false && btnImage12.IsEnabled == false && btnImage13.IsEnabled == false && btnImage14.IsEnabled == false && btnImage15.IsEnabled == false && btnImage16.IsEnabled == false && btnImage17.IsEnabled == false && btnImage18.IsEnabled == false && btnImage19.IsEnabled == false && btnImage20.IsEnabled == false && btnImage21.IsEnabled == false && btnImage22.IsEnabled == false && btnImage23.IsEnabled == false && btnImage24.IsEnabled == false) { gameTime.Stop(); System.IO.Stream gameWinStream = Properties.Resources.gameWin; System.Media.SoundPlayer gameWinPlayer = new System.Media.SoundPlayer(gameWinStream); gameWinPlayer.Play(); GameWin main = new GameWin(); App.Current.MainWindow = main; main.Show(); } else if (playTime == 0) { btnImage1.IsEnabled = false; btnImage2.IsEnabled = false; btnImage3.IsEnabled = false; btnImage4.IsEnabled = false; btnImage5.IsEnabled = false; btnImage6.IsEnabled = false; btnImage8.IsEnabled = false; btnImage9.IsEnabled = false; btnImage10.IsEnabled = false; btnImage11.IsEnabled = false; btnImage12.IsEnabled = false; btnImage13.IsEnabled = false; btnImage14.IsEnabled = false; btnImage15.IsEnabled = false; btnImage16.IsEnabled = false; btnImage17.IsEnabled = false; btnImage18.IsEnabled = false; btnImage19.IsEnabled = false; btnImage20.IsEnabled = false; btnImage21.IsEnabled = false; btnImage22.IsEnabled = false; btnImage23.IsEnabled = false; btnImage24.IsEnabled = false; gameCountDownBeforeStart.Text = ""; gameCountDownPlay.TextAlignment = TextAlignment.Center; gameCountDownPlay.Foreground = new SolidColorBrush(Colors.Red); gameCountDownPlay.Text = "Joc terminat"; GameOver main = new GameOver(); App.Current.MainWindow = main; main.Show(); System.IO.Stream gameOverStream = Properties.Resources.gameOver; System.Media.SoundPlayer gameOverPlayer = new System.Media.SoundPlayer(gameOverStream); gameOverPlayer.Play(); } } }