Beispiel #1
0
 private void bmrResultButton_Click(object sender, RoutedEventArgs e)
 {
     if (calculator.Hip > 0 && calculator.Waist > 0 && calculator.Waist < 110 && calculator.Hip < 100 && (radioButtonMale.IsChecked == true || radioButtonFemale.IsChecked == true))
     {
         resultBox.Text = (Math.Round(calculator.CalculateWHR(), 2)).ToString();
         if (radioButtonFemale.IsChecked == true)
         {
             if (calculator.whr <= 0.8)
             {
                 resultBox2.Text = "Your waist to hip circumference is within the ideal range.";
             }
             else if (calculator.whr > 0.8 && calculator.whr < 0.9)
             {
                 resultBox2.Text = "Your waist to hip circumference is slightly above the ideal range.";
             }
             else if (calculator.whr >= 0.9)
             {
                 resultBox2.Text = "Your waist to hip circumference suggests your body shape and weight are putting you at increased risk of developing conditions such as heart disease and diabetes.";
             }
         }
         else if (radioButtonMale.IsChecked == true)
         {
             if (calculator.whr < 0.9)
             {
                 resultBox2.Text = "Your waist to hip circumference is within the ideal range.";
             }
             else if (calculator.whr >= 0.9 && calculator.whr < 1)
             {
                 resultBox2.Text = "Your waist to hip circumference is slightly above the ideal range.";
             }
             else if (calculator.whr >= 1)
             {
                 resultBox2.Text = "Your waist to hip circumference suggests your body shape and weight are putting you at increased risk of developing conditions such as heart disease and diabetes.";
             }
         }
         else
         {
             resultBox2.Text = "Select your gender";
         }
     }
     else
     {
         resultBox2.Text = "Incorrect input";
     }
 }