Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/19/14 16:09:47 (10 years ago)
Author:
sbreuer
Message:
  • further enhancements of FilterAndReplaceDialog
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FindAndReplaceDialog.cs

    r10633 r10636  
    1 using System.Windows.Forms;
     1using System;
     2using System.Windows.Forms;
    23
    34namespace HeuristicLab.DataPreprocessing.Views {
     
    56    public FindAndReplaceDialog() {
    67      InitializeComponent();
     8      string[] cmbItems = { "Value", "Average", "Median", "Random", "Most Common", "Interpolation" };
     9      cmbReplaceWith.Items.AddRange(cmbItems);
    710    }
    811
    912    public void ActivateSearch() {
    1013      tabSearch.Focus();
     14      AddControlsToCurrentTab();
    1115    }
    1216
    1317    public void ActivateReplace() {
    1418      tabReplace.Focus();
     19      AddControlsToCurrentTab();
    1520    }
    1621
    17     private void tabControl1_SelectedIndexChanged(object sender, System.EventArgs e) {
    18       if (sender is TabControl) {
    19         TabControl tc = (TabControl)sender;
    20         tc.SelectedTab.Controls.Add(btnFindAll);
    21         tc.SelectedTab.Controls.Add(btnFindNext);
    22         tc.SelectedTab.Controls.Add(lblSearch);
    23         tc.SelectedTab.Controls.Add(txtSearchString);
    24       }
     22    private void tabSearchReplace_SelectedIndexChanged(object sender, System.EventArgs e) {
     23      AddControlsToCurrentTab();
    2524    }
    2625
     26    private void AddControlsToCurrentTab() {
     27      tabSearchReplace.SelectedTab.Controls.Add(btnFindAll);
     28      tabSearchReplace.SelectedTab.Controls.Add(btnFindNext);
     29      tabSearchReplace.SelectedTab.Controls.Add(lblSearch);
     30      tabSearchReplace.SelectedTab.Controls.Add(txtSearchString);
     31    }
     32
     33    public string GetSearchText() {
     34      return txtSearchString.Text;
     35    }
     36
     37    public string GetReplaceText() {
     38      return txtValue.Text;
     39    }
     40
     41    public string GetReplaceAction() {
     42      return cmbReplaceWith.SelectedText;
     43    }
     44
     45    public event EventHandler FindAllEvent {
     46      add { btnFindAll.Click += value; }
     47      remove { btnFindAll.Click -= value; }
     48    }
     49
     50    public event EventHandler FindNextEvent {
     51      add { btnFindNext.Click += value; }
     52      remove { btnFindNext.Click -= value; }
     53    }
     54
     55    public event EventHandler ReplaceAllEvent {
     56      add { btnReplaceAll.Click += value; }
     57      remove { btnReplaceAll.Click -= value; }
     58    }
     59
     60    public event EventHandler ReplaceNextEvent {
     61      add { btnReplaceNext.Click += value; }
     62      remove { btnReplaceNext.Click -= value; }
     63    }
     64     
    2765  }
    2866}
Note: See TracChangeset for help on using the changeset viewer.