Exemplo n.º 1
0
        private void Calculation()
        {
            if (boxGrowth.Text != "" && boxWeight.Text != "" && (Convert.ToDouble(boxGrowth.Text) != 0 && Convert.ToDouble(boxWeight.Text) != 0))
            {
                double G = Convert.ToDouble(boxGrowth.Text);
                double W = Convert.ToDouble(boxWeight.Text);

                G = G / 100;

                OutputWin outputWin = new OutputWin(G, W);
                this.Hide();
                outputWin.ShowDialog();
                this.Show();
            }
        }
Exemplo n.º 2
0
        private void CalculationBmr()
        {
            _age    = Convert.ToInt32(boxAge.Text);
            _growth = Convert.ToDouble(boxGrowth.Text);
            _weight = Convert.ToDouble(boxWeight.Text);


            if (rdbWeightFunt.IsChecked == true)
            {
                _weight = _weight / 2.205;
            }

            if (rdbGenderMale.IsChecked == true)
            {
                _gender = 1;
            }
            else
            {
                _gender = 2;
            }


            if (rdbFormulaHarris.IsChecked == true)
            {
                _result = CalculationClass.CalculationBMRHarris(_weight, _age, _growth, _gender);
            }

            if (rdbFormulaMaffin.IsChecked == true)
            {
                _result = CalculationClass.CalculationBMRMaffin(_weight, _age, _growth, _gender);
            }

            switch (cmbLevel.SelectedIndex)
            {
            case 1:
                _result = _result * 1.2;
                break;

            case 2:
                _result = _result * 1.375;
                break;

            case 3:
                _result = _result * 1.4625;
                break;

            case 4:
                _result = _result * 1.550;
                break;

            case 5:
                _result = _result * 1.6375;
                break;

            case 6:
                _result = _result * 1.725;
                break;

            case 7:
                _result = _result * 1.9;
                break;
            }

            if (rdbResultDjoul.IsChecked == true)
            {
                _result = _result * 4.184;
                _joul   = 1;
            }
            else
            {
                _joul = 0;
            }


            OutputWin outputWin = new OutputWin(_result, _joul);

            this.Hide();
            outputWin.ShowDialog();
            this.Show();
        }