using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace HeuristicLab.DataImporter.Command.View { public partial class ThresholdCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase { private ThresholdCommandView() { InitializeComponent(); this.txtThreshold.Text = (0.5).ToString(); } public ThresholdCommandView(DeleteColumnsWithTooFewValuesCommand command) : this() { this.Command = command; this.UpdateCommand(); } public new DeleteColumnsWithTooFewValuesCommand Command { get { return (DeleteColumnsWithTooFewValuesCommand)base.Command; } set { base.Command = value; this.UpdateCommand(); } } public double Threshold { get { return Command.Threshold; } } private void textBox_Validating(object sender, CancelEventArgs e) { TextBox textBox = (TextBox)sender; double value; if (!double.TryParse(textBox.Text, out value)) e.Cancel = true; if (value < 0 || value > 1) e.Cancel = true; if (e.Cancel) MessageBox.Show("A numeric value between 0 and 1 must be entered!"); else this.UpdateCommand(); } private void UpdateCommand() { if (this.Command != null) { double value; if (double.TryParse(txtThreshold.Text, out value)) this.Command.Threshold = value; } } } }