private void timeAttack(object sender, RoutedEventArgs e) { if (windowType == -1) { if (playerID != -1) { // Time Attack kinectSensorChooser.Stop(); DragDropImages dragDropImages = new DragDropImages(playerID, 1); Close(); dragDropImages.ShowDialog(); kinectSensorChooser.Start(); } else { // Multiplayer // Multiplayer game, log in not required, playerID == -1 Multiplayer multiplayer = null; kinectSensorChooser.Stop(); // Time Attack multiplayer = new Multiplayer(1); VisualStateManager.GoToState(btnTimeAttack, "MouseOver", true); if (multiplayer != null) { Close(); // Start the game for player 1 then player 2 player1Score = multiplayer.StartGame(); multiplayer = new Multiplayer(1); player2Score = multiplayer.StartGame(); kinectSensorChooser.Start(); // Find the winner CustomMessageBox customMessageBox = new CustomMessageBox(kinectSensorChooser); if (player1Score > player2Score) { customMessageBox.ShowText("Winner is Player #1\nScore: " + player1Score, "Game Ended"); } else if (player2Score > player1Score) { customMessageBox.ShowText("Winner is Player #2\nScore: " + player2Score, "Game Ended"); } else { // If draw customMessageBox.ShowText("DRAW!\nScore: " + player1Score, "Game Ended"); } return; } } } else { // Time attack HighScore highScore = new HighScore(kinectSensorChooser, 1); highScore.Show(); Close(); } }