Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/22/12 15:03:32 (11 years ago)
Author:
bburlacu
Message:

#1763: Bugfixes and refactoring as suggested in the comments above.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.cs

    r8409 r8935  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     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
     22using System;
    223using System.Collections.Generic;
    324using System.ComponentModel;
     
    930namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    1031  public partial class InsertNodeDialog : Form {
    11     public string Caption {
    12       get { return this.Text; }
    13       set {
    14         if (InvokeRequired)
    15           Invoke(new Action<string>(x => this.Caption = x), value);
    16         else
    17           this.Text = value;
    18       }
    19     }
    20 
    2132    public InsertNodeDialog() {
    2233      InitializeComponent();
     
    5566        constantValueTextBox.Visible = false;
    5667        // add controls to the dialog for changing the variable name or weight
     68      } else {
     69        variableNameLabel.Visible = false;
     70        variableNamesCombo.Visible = false;
     71        variableWeightLabel.Visible = false;
     72        variableWeightTextBox.Visible = false;
     73        constantValueLabel.Visible = false;
     74        constantValueTextBox.Visible = false;
    5775      }
    5876    }
     
    90108
    91109    public event EventHandler DialogValidated;
     110    private void OnDialogValidated(object sender, EventArgs e) {
     111      var dialogValidated = DialogValidated;
     112      if (dialogValidated != null)
     113        dialogValidated(sender, e);
     114    }
    92115
    93116    private void childControl_KeyDown(object sender, KeyEventArgs e) {
     
    98121      if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return) {
    99122        if (ValidateChildren()) {
    100           DialogValidated(this, e);
     123          OnDialogValidated(this, e);
    101124          Close();
    102125        }
    103126      }
    104127    }
     128
     129    private void okButton_Click(object sender, EventArgs e) {
     130      if (ValidateChildren()) {
     131        OnDialogValidated(this, e);
     132        Close();
     133      }
     134    }
     135
     136    private void cancelButton_Click(object sender, EventArgs e) {
     137      Close();
     138    }
    105139  }
    106140}
Note: See TracChangeset for help on using the changeset viewer.