Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FindAndReplaceDialog.cs @ 10672

Last change on this file since 10672 was 10672, checked in by sbreuer, 10 years ago
  • change function headers in manipulationlogic to interface datatypes
  • implemented find and replace logic
File size: 2.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Windows.Forms;
4
5namespace HeuristicLab.DataPreprocessing.Views {
6  public enum ReplaceAction {
7    Value,
8    Average,
9    Median,
10    Random,
11    MostCommon,
12    Interpolation
13  }
14
15  public partial class FindAndReplaceDialog : Form {
16    private string[] cmbItemsText = { "Value", "Average", "Median", "Random", "Most Common", "Interpolation" };
17
18    public FindAndReplaceDialog() {
19      InitializeComponent();
20      cmbReplaceWith.Items.AddRange(cmbItemsText);
21      cmbReplaceWith.SelectedIndex = (int)ReplaceAction.Value;
22    }
23
24    public void ActivateSearch() {
25      tabSearch.Focus();
26      AddControlsToCurrentTab();
27    }
28
29    public void ActivateReplace() {
30      tabReplace.Focus();
31      AddControlsToCurrentTab();
32    }
33
34    private void tabSearchReplace_SelectedIndexChanged(object sender, System.EventArgs e) {
35      AddControlsToCurrentTab();
36    }
37
38    private void cmbReplaceWith_SelectedIndexChanged(object sender, System.EventArgs e) {
39      lblValue.Visible = txtValue.Visible = cmbReplaceWith.SelectedIndex == (int)ReplaceAction.Value;
40    }
41
42    private void AddControlsToCurrentTab() {
43      tabSearchReplace.SelectedTab.Controls.Add(btnFindAll);
44      tabSearchReplace.SelectedTab.Controls.Add(btnFindNext);
45      tabSearchReplace.SelectedTab.Controls.Add(lblSearch);
46      tabSearchReplace.SelectedTab.Controls.Add(txtSearchString);
47    }
48
49    public String GetSearchText() {
50      return txtSearchString.Text;
51    }
52
53    public string GetReplaceText() {
54      return txtValue.Text;
55    }
56
57    public ReplaceAction GetReplaceAction() {
58      return (ReplaceAction)cmbReplaceWith.SelectedIndex;
59    }
60
61    public event EventHandler FindAllEvent {
62      add { btnFindAll.Click += value; }
63      remove { btnFindAll.Click -= value; }
64    }
65
66    public event EventHandler FindNextEvent {
67      add { btnFindNext.Click += value; }
68      remove { btnFindNext.Click -= value; }
69    }
70
71    public event EventHandler ReplaceAllEvent {
72      add { btnReplaceAll.Click += value; }
73      remove { btnReplaceAll.Click -= value; }
74    }
75
76    public event EventHandler ReplaceNextEvent {
77      add { btnReplace.Click += value; }
78      remove { btnReplace.Click -= value; }
79    }
80     
81  }
82}
Note: See TracBrowser for help on using the repository browser.