Changeset 13855 for branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChartConfigurationDialog.cs
- Timestamp:
- 05/20/16 13:01:24 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChartConfigurationDialog.cs
r13853 r13855 21 21 22 22 using System; 23 using System.ComponentModel; 23 24 using System.Globalization; 24 25 using System.Windows.Forms; … … 28 29 public partial class GradientChartConfigurationDialog : Form { 29 30 private readonly GradientChart chart; 30 31 private IFormatProvider FormatProvider {32 get { return CultureInfo.CurrentUICulture.NumberFormat; }33 }34 31 35 32 public GradientChartConfigurationDialog(GradientChart chart) { … … 41 38 if (chart.FixedXAxisMin.HasValue && chart.FixedXAxisMax.HasValue) { 42 39 xAutomaticCheckBox.Checked = false; 43 minXTextBox.Text = chart.FixedXAxisMin.Value.ToString( FormatProvider);44 maxXTextBox.Text = chart.FixedXAxisMax.Value.ToString( FormatProvider);40 minXTextBox.Text = chart.FixedXAxisMin.Value.ToString(CultureInfo.CurrentUICulture); 41 maxXTextBox.Text = chart.FixedXAxisMax.Value.ToString(CultureInfo.CurrentUICulture); 45 42 } else xAutomaticCheckBox.Checked = true; 46 43 if (chart.FixedYAxisMin.HasValue && chart.FixedYAxisMax.HasValue) { 47 44 yAutomaticCheckBox.Checked = false; 48 minYTextBox.Text = chart.FixedYAxisMin.Value.ToString( FormatProvider);49 maxYTextBox.Text = chart.FixedYAxisMax.Value.ToString( FormatProvider);45 minYTextBox.Text = chart.FixedYAxisMin.Value.ToString(CultureInfo.CurrentUICulture); 46 maxYTextBox.Text = chart.FixedYAxisMax.Value.ToString(CultureInfo.CurrentUICulture); 50 47 } else yAutomaticCheckBox.Checked = true; 51 48 StepsNumericUpDown.Value = chart.DrawingSteps; … … 59 56 chart.FixedXAxisMax = null; 60 57 } else { 61 var min = Convert.ToDouble(minXTextBox.Text, FormatProvider);62 var max = Convert.ToDouble(maxXTextBox.Text, FormatProvider);58 var min = double.Parse(minXTextBox.Text, CultureInfo.CurrentUICulture); 59 var max = double.Parse(maxXTextBox.Text, CultureInfo.CurrentUICulture); 63 60 chart.FixedXAxisMin = min; 64 61 chart.FixedXAxisMax = max; … … 69 66 chart.FixedYAxisMax = null; 70 67 } else { 71 var min = Convert.ToDouble(minYTextBox.Text, FormatProvider);72 var max = Convert.ToDouble(maxYTextBox.Text, FormatProvider);68 var min = double.Parse(minYTextBox.Text, CultureInfo.CurrentUICulture); 69 var max = double.Parse(maxYTextBox.Text, CultureInfo.CurrentUICulture); 73 70 chart.FixedYAxisMin = min; 74 71 chart.FixedYAxisMax = max; … … 81 78 Close(); 82 79 } 83 catch (FormatException fe) {84 MessageBox.Show(this, "Illegal number format : {0}", fe.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);80 catch (FormatException) { 81 MessageBox.Show(this, "Illegal number format", "Wrong format", MessageBoxButtons.OK, MessageBoxIcon.Error); 85 82 } 86 83 finally { … … 96 93 maxYTextBox.Enabled = !yAutomaticCheckBox.Checked; 97 94 } 95 96 private void numberTextBox_Validating(object sender, CancelEventArgs e) { 97 var textBox = sender as TextBox; 98 if (textBox != null) { 99 double number; 100 if (!double.TryParse(textBox.Text, NumberStyles.Any, CultureInfo.CurrentUICulture, out number)) { 101 e.Cancel = true; 102 applyButton.Enabled = false; 103 errorProvider.SetIconAlignment(textBox, ErrorIconAlignment.MiddleLeft); 104 errorProvider.SetIconPadding(textBox, 2); 105 errorProvider.SetError(textBox, "Illegal number format"); 106 textBox.SelectAll(); 107 } 108 } 109 } 110 111 private void numberTextBox_Validated(object sender, EventArgs e) { 112 var textBox = sender as TextBox; 113 if (textBox != null) { 114 errorProvider.SetError(textBox, string.Empty); 115 applyButton.Enabled = true; 116 } 117 } 98 118 } 99 119 }
Note: See TracChangeset
for help on using the changeset viewer.