private void Button_Hitung_Click(object sender, RoutedEventArgs e)
        {
            var nominalInput = InputTextBox.Text;
            var result       = "invalid";

            if (currencyController.isAllowed(nominalInput))
            {
                result = currencyController.usdToIdr(nominalInput);
            }
            resultLabel.Content = result;
        }
Beispiel #2
0
        private void Button_Hitung_Click(object sender, RoutedEventArgs e)
        {
            //Pelatihan 1

            /*var nominalString = InputTextBox.Text;
             * resultLabel.Content = nominalString;*/

            //Pelatihan 2

            /*var nominalString = InputTextBox.Text;
             * var nominalDouble = Convert.ToDouble(nominalString);
             * resultLabel.Content = Convert.ToString(nominalDouble * 10000);*/

            //pelatihan 3

            /*var nominalString = InputTextBox.Text;
             * Regex regex = new Regex("[^0-9.-]+");
             * if (!regex.IsMatch(nominalString))
             * {
             *  var nominalDouble = Convert.ToDouble(nominalString);
             *  resultLabel.Content = Convert.ToString(nominalDouble * 4);
             * }
             * else
             * {
             *  resultLabel.Content = "Invalid";
             * }*/
            //pakai currency controller
            var nominalInput = InputTextBox.Text;
            var result       = "invalid";

            if (currencyController.isAllowed(nominalInput))
            {
                result = currencyController.usdToIdr(nominalInput);
            }
            resultLabel.Content = result;
        }