Esempio n. 1
0
        /// <summary>
        /// Checks wether the inputed text is numeric and then calculate the inputed number factorial
        /// </summary>
        private void calculateBtn_Click(object sender, RoutedEventArgs e)
        {
            Console.WriteLine(Mode);
            int  n;
            bool isNumeric = int.TryParse(FactorialValueTextBox, out n);

            if (isNumeric)
            {
                FactorialResult = Mathematics.Factorial(n);
            }
        }
Esempio n. 2
0
 public Factorial(double mode)
 {
     InitializeComponent();
     DataContext = this;
     try
     {
         Mode            = mode;
         FactorialResult = Mathematics.Factorial((int)Mode);
     }
     catch (InvalidCastException ex)
     {
         Console.WriteLine(ex.Message);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }