#region License Information /* HeuristicLab * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Windows.Forms; using HeuristicLab.DataImporter.Data.CommandBase; namespace HeuristicLab.DataImporter.Command.View { public partial class DeleteWithThreshold : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase { public DeleteWithThreshold() { InitializeComponent(); } public DeleteWithThreshold(IThresholdCommand command) : this() { if (command != null) { threshold = command.Threshold; txtThreshold.Text = command.Threshold.ToString(); } this.Command = command; } public new IThresholdCommand Command { get { return (IThresholdCommand)base.Command; } set { base.Command = value; this.UpdateCommand(); } } private double threshold; public double Threshold { get { return Command.Threshold; } } private void txtThreshold_Validating(object sender, System.ComponentModel.CancelEventArgs e) { TextBox textBox = (TextBox)sender; e.Cancel = !Double.TryParse(textBox.Text, out threshold); e.Cancel = e.Cancel || threshold < 0.0 || threshold > 1.0; if (e.Cancel) { MessageBox.Show("Threshold has to be between 0.0 and 1.0"); } else { UpdateCommand(); } } private void UpdateCommand() { if (this.Command != null) { Command.Threshold = this.threshold; } } } }