Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/BoxCoxTransformationCommandView.cs @ 6133

Last change on this file since 6133 was 6133, checked in by gkronber, 13 years ago

#1471: imported generic parts of DataImporter from private code base

File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Text;
7using System.Windows.Forms;
8
9namespace HeuristicLab.DataImporter.Command.View {
10  public partial class BoxCoxTransformationCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
11    private BoxCoxTransformationCommandView() {
12      InitializeComponent();
13    }
14
15    public BoxCoxTransformationCommandView(BoxCoxTransformationCommand command)
16      : this() {
17      this.Command = command;
18    }
19
20    public new BoxCoxTransformationCommand Command {
21      get { return (BoxCoxTransformationCommand)base.Command; }
22      set { base.Command = value; this.UpdateCommand(); }
23    }
24
25    public double Lambda {
26      get { return this.Command.Lambda; }
27    }
28    public double C {
29      get { return this.Command.C; }
30    }
31
32    private void textBox_Validating(object sender, CancelEventArgs e) {
33      TextBox textBox = (TextBox)sender;
34      double value;
35      if (!double.TryParse(textBox.Text, out value)) {
36        e.Cancel = true;
37        MessageBox.Show("A numeric value must be entered!");
38      } else
39        this.UpdateCommand();
40    }
41
42    private void UpdateCommand() {
43      if (this.Command != null) {
44        double value;
45        if (double.TryParse(this.txtLambda.Text, out value))
46          this.Command.Lambda = value;
47        if (double.TryParse(this.txtC.Text, out value)) {
48          this.Command.C = value;
49        }
50      }
51    }
52  }
53}
Note: See TracBrowser for help on using the repository browser.