private void btn_Click(object sender, RoutedEventArgs e) { SoloGameWindow game = null; try { Button test = (Button)sender; //need to cast this to button to get its name or content for the switch switch (test.Content.ToString()) { case "Classic": game = new SoloGameWindow("Classic"); break; case "Skee Ball": game = new SoloGameWindow("Modern"); break; case "Multi Ball": case "310": case "510": case "Cricket": //game = new CricketWindow("Cricket"); break; case "Tic Tac Three": case "Tic Tac Skee": default: game = new SoloGameWindow("Classic"); break; } game.Owner = this; game.ShowDialog(); } catch (Exception) { System.Windows.Forms.MessageBox.Show("Something that wasn't a button called the btn_Click function"); throw; } }
private void btnClassic_Click(object sender, RoutedEventArgs e) { SoloGameWindow game = new SoloGameWindow("Classic"); game.Owner = this; game.ShowDialog(); }
private void btn510_Click(object sender, RoutedEventArgs e) { SoloGameWindow game = new SoloGameWindow("FiveTen"); game.Owner = this; game.ShowDialog(); }
private void btnMultiBall_Click(object sender, RoutedEventArgs e) { SoloGameWindow game = new SoloGameWindow("Multi"); game.Owner = this; game.ShowDialog(); }