private void SwitchUnitedStatesCustomaryUnits_IP_InternationalSystemOfUnits_IS_()
        {
            if (MerkelViewModel.ConvertValues(IsInternationalSystemOfUnits_IS_, MerkleElevationRadio.Checked))
            {
                SwitchCalculation();
            }

            if (IsInternationalSystemOfUnits_IS_)
            {
                if (MerkleElevationRadio.Checked)
                {
                    MerkelElevationPressureUnits.Text = ConstantUnits.Meter;
                }
                else
                {
                    MerkelElevationPressureUnits.Text = ConstantUnits.BarometricPressureKiloPascal;
                }
            }
            else
            {
                if (MerkleBarometricPressureRadio.Checked)
                {
                    MerkelElevationPressureUnits.Text = ConstantUnits.Foot;
                }
                else
                {
                    MerkelElevationPressureUnits.Text = ConstantUnits.BarometricPressureInchOfMercury;
                }
            }
        }
        private void Merkel_Elevation_Value_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            string errorMessage = string.Empty;

            if (MerkleElevationRadio.Checked)
            {
                if (!MerkelViewModel.ElevationDataValueUpdateValue(Merkel_Elevation_Value.Text, out errorMessage))
                {
                    // Cancel the event and select the text to be corrected by the user.
                    e.Cancel = true;
                    Merkel_Elevation_Value.Select(0, Merkel_Elevation_Value.Text.Length);

                    // Set the ErrorProvider error with the text to display.
                    this.errorProvider1.SetError(Merkel_Elevation_Value, errorMessage);
                }
            }
            else
            {
                if (!MerkelViewModel.BarometricPressureDataValueUpdateValue(Merkel_Elevation_Value.Text, out errorMessage))
                {
                    // Cancel the event and select the text to be corrected by the user.
                    e.Cancel = true;
                    Merkel_Elevation_Value.Select(0, Merkel_Elevation_Value.Text.Length);

                    // Set the ErrorProvider error with the text to display.
                    this.errorProvider1.SetError(Merkel_Elevation_Value, errorMessage);
                }
            }
        }
        private void CalculateMerkel()
        {
            string errorMessage = string.Empty;

            try
            {
                if (MerkelViewModel.CalculateMerkel(MerkleElevationRadio.Checked, out errorMessage))
                {
                    if (MerkelGridView.DataSource != null)
                    {
                        MerkelGridView.DataSource = null;
                    }

                    if (MerkelViewModel.GetDataTable() != null)
                    {
                        // Set a DataGrid control's DataSource to the DataView.
                        MerkelGridView.DataSource = new DataView(MerkelViewModel.GetDataTable());
                    }
                }
                else
                {
                    MessageBox.Show(errorMessage);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(string.Format("Error in Merkel calculation. Please check your input values. Exception Message: {0}", exception.Message), "Merkel Calculation Error");
            }
        }
        public MerkelTabPage(ApplicationSettings applicationSettings)
        {
            InitializeComponent();

            IsInternationalSystemOfUnits_IS_ = (applicationSettings.UnitsSelection == UnitsSelection.International_System_Of_Units_SI);

            MerkelViewModel = new MerkelViewModel(IsDemo, IsInternationalSystemOfUnits_IS_);

            Setup();

            CalculateMerkel();
        }
        private void Merkel_WetBulbTemperature_Value_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            string errorMessage = string.Empty;

            if (!MerkelViewModel.WetBulbTemperatureDataValueUpdateValue(Merkel_WetBulbTemperature_Value.Text, out errorMessage))
            {
                // Cancel the event and select the text to be corrected by the user.
                e.Cancel = true;
                Merkel_WetBulbTemperature_Value.Select(0, Merkel_WetBulbTemperature_Value.Text.Length);

                // Set the ErrorProvider error with the text to display.
                this.errorProvider1.SetError(Merkel_WetBulbTemperature_Value, errorMessage);
            }
        }