Esempio n. 1
0
 // END CUT HERE
 // BEGIN CUT HERE
 public static void Main()
 {
     try {
     AdditionGame ___test = new AdditionGame();
     ___test.run_test(-1);
     } catch(Exception e) {
     //Console.WriteLine(e.StackTrace);
     Console.WriteLine(e.ToString());
     }
 }
Esempio n. 2
0
// END CUT HERE
// BEGIN CUT HERE
    public static void Main()
    {
        try {
            AdditionGame ___test = new AdditionGame();
            ___test.run_test(-1);
        } catch (Exception e) {
//Console.WriteLine(e.StackTrace);
            Console.WriteLine(e.ToString());
        }
    }
        /// <summary>
        /// Click event handler for the operator buttons
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event object</param>
        private void OperatorBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Cast sender to Button
                Button myButton = (Button)sender;
                //Initialise game to null
                Game g = null;

                //Create the new game corresponnding to the button clicked
                switch (myButton.Uid)
                {
                case "Addition":
                    g = new AdditionGame(p);
                    break;

                case "Subtraction":
                    g = new SubtractionGame(p);
                    break;

                case "Multiplication":
                    g = new MultiplicationGame(p);
                    break;

                case "Division":
                    g = new DivisionGame(p);
                    break;
                }

                if (g != null)
                {
                    //Start the game
                    GameForm gameForm = new GameForm(g, p);
                    App.Current.MainWindow = gameForm;
                    this.Close();
                    gameForm.Show();
                }
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }