Last change
on this file since 6133 was
6133,
checked in by gkronber, 14 years ago
|
#1471: imported generic parts of DataImporter from private code base
|
File size:
1.5 KB
|
Rev | Line | |
---|
[6133] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.ComponentModel;
|
---|
| 4 | using System.Data;
|
---|
| 5 | using System.Drawing;
|
---|
| 6 | using System.Text;
|
---|
| 7 | using System.Windows.Forms;
|
---|
| 8 |
|
---|
| 9 | namespace HeuristicLab.DataImporter.Command.View {
|
---|
| 10 | public partial class ThresholdCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
|
---|
| 11 | private ThresholdCommandView() {
|
---|
| 12 | InitializeComponent();
|
---|
| 13 | this.txtThreshold.Text = (0.5).ToString();
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | public ThresholdCommandView(DeleteColumnsWithTooFewValuesCommand command)
|
---|
| 17 | : this() {
|
---|
| 18 | this.Command = command;
|
---|
| 19 | this.UpdateCommand();
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | public new DeleteColumnsWithTooFewValuesCommand Command {
|
---|
| 23 | get { return (DeleteColumnsWithTooFewValuesCommand)base.Command; }
|
---|
| 24 | set { base.Command = value; this.UpdateCommand(); }
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | public double Threshold {
|
---|
| 28 | get { return Command.Threshold; }
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | private void textBox_Validating(object sender, CancelEventArgs e) {
|
---|
| 32 | TextBox textBox = (TextBox)sender;
|
---|
| 33 | double value;
|
---|
| 34 | if (!double.TryParse(textBox.Text, out value))
|
---|
| 35 | e.Cancel = true;
|
---|
| 36 | if (value < 0 || value > 1)
|
---|
| 37 | e.Cancel = true;
|
---|
| 38 | if (e.Cancel)
|
---|
| 39 | MessageBox.Show("A numeric value between 0 and 1 must be entered!");
|
---|
| 40 | else
|
---|
| 41 | this.UpdateCommand();
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | private void UpdateCommand() {
|
---|
| 45 | if (this.Command != null) {
|
---|
| 46 | double value;
|
---|
| 47 | if (double.TryParse(txtThreshold.Text, out value))
|
---|
| 48 | this.Command.Threshold = value;
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
| 51 | }
|
---|
| 52 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.