[6134] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[9615] | 3 | * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[6134] | 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
[6133] | 22 | using System.ComponentModel;
|
---|
| 23 | using System.Windows.Forms;
|
---|
| 24 |
|
---|
| 25 | namespace HeuristicLab.DataImporter.Command.View {
|
---|
| 26 | public partial class MinMaxCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
|
---|
| 27 | private MinMaxCommandView() {
|
---|
| 28 | InitializeComponent();
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | public MinMaxCommandView(ScalingBetweenMinAndMaxCommand command)
|
---|
| 32 | : this() {
|
---|
| 33 | this.Command = command;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | public new ScalingBetweenMinAndMaxCommand Command {
|
---|
| 37 | get { return (ScalingBetweenMinAndMaxCommand)base.Command; }
|
---|
| 38 | set { base.Command = value; this.UpdateCommand(); }
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | public double MinValue {
|
---|
| 42 | get { return Command.MinValue; }
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | public double MaxValue {
|
---|
| 46 | get { return Command.MaxValue; }
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | private void textBox_Validating(object sender, CancelEventArgs e) {
|
---|
| 50 | TextBox textBox = (TextBox)sender;
|
---|
| 51 | double value;
|
---|
| 52 | if (!double.TryParse(textBox.Text, out value)) {
|
---|
| 53 | e.Cancel = true;
|
---|
| 54 | MessageBox.Show("A numeric value must be entered!");
|
---|
| 55 | } else
|
---|
| 56 | this.UpdateCommand();
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | private void UpdateCommand() {
|
---|
| 60 | if (this.Command != null) {
|
---|
| 61 | double value;
|
---|
| 62 | if (double.TryParse(this.txtMin.Text, out value))
|
---|
| 63 | this.Command.MinValue = value;
|
---|
| 64 | if (double.TryParse(this.txtMax.Text, out value))
|
---|
| 65 | this.Command.MaxValue = value;
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 | }
|
---|
| 69 | }
|
---|