コード例 #1
0
        private void populateEnglishOutputBoxesWithConvertedValues(MetricToEnglish mte)
        {
            grpEnglish.Visible = true;

            txtMiles.Text  = mte.getMiles();
            txtYards.Text  = mte.getYards();
            txtInches.Text = mte.getInches();
            txtFeet.Text   = mte.getFeet();
        }
コード例 #2
0
        private void btnConvert_Click(object sender, EventArgs e)
        {
            if (noChoiceMade())
            {
                return;
            }

            if (optEnglishToMetric.Checked || optMetricToEnglish.Checked)
            {
                dealWithBlankInputBoxes();
            }

            if (optMetricToEnglish.Checked)
            {
                MetricToEnglish mte = new MetricToEnglish(txtKilometers.Text, txtMeters.Text, txtCentimeters.Text);
                populateEnglishOutputBoxesWithConvertedValues(mte);
            }

            else
            {
                EnglishToMetric etm = new EnglishToMetric(txtInches.Text, txtFeet.Text, txtYards.Text, txtMiles.Text);
                populateMetricOutputBoxesWithConvertedValues(etm);
            }
        }