private void PsychrometricsCalculate_Click(object sender, EventArgs e) { string errorMessage = string.Empty; ClearDataSource(); try { if (PsychrometricsViewModel.CalculatePsychrometrics(PsychrometricsElevationRadio.Checked, out errorMessage)) { if (PsychrometricsViewModel.GetDataTable() != null) { // Set a DataGrid control's DataSource to the DataView. Psychrometrics_GridView.DataSource = new DataView(PsychrometricsViewModel.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"); } }
private void Psychrometrics_Elevation_Value_Validating(object sender, System.ComponentModel.CancelEventArgs e) { string errorMessage = string.Empty; if (PsychrometricsElevationRadio.Checked) { if (!PsychrometricsViewModel.ElevationDataValueUpdateValue(Psychrometrics_Elevation_Value.Text, out errorMessage)) { // Cancel the event and select the text to be corrected by the user. e.Cancel = true; Psychrometrics_Elevation_Value.Select(0, Psychrometrics_Elevation_Value.Text.Length); // Set the ErrorProvider error with the text to display. this.errorProvider1.SetError(Psychrometrics_Elevation_Value, errorMessage); } } else { if (!PsychrometricsViewModel.BarometricPressureDataValueUpdateValue(Psychrometrics_Elevation_Value.Text, out errorMessage)) { // Cancel the event and select the text to be corrected by the user. e.Cancel = true; Psychrometrics_Elevation_Value.Select(0, Psychrometrics_Elevation_Value.Text.Length); // Set the ErrorProvider error with the text to display. this.errorProvider1.SetError(Psychrometrics_Elevation_Value, errorMessage); } } }
public PsychrometricsTabPage(ApplicationSettings applicationSettings) { InitializeComponent(); IsInternationalSystemOfUnits_IS_ = (applicationSettings.UnitsSelection == UnitsSelection.International_System_Of_Units_SI); IsInternationalSystemOfUnits_IS_ = false; IsDemo = applicationSettings.IsDemo; IsInternationalSystemOfUnits_IS_ = false; PsychrometricsViewModel = new PsychrometricsViewModel(IsDemo, IsInternationalSystemOfUnits_IS_); }