[10636] | 1 | using System;
|
---|
[10672] | 2 | using System.Collections.Generic;
|
---|
[10636] | 3 | using System.Windows.Forms;
|
---|
[10630] | 4 |
|
---|
| 5 | namespace HeuristicLab.DataPreprocessing.Views {
|
---|
[10672] | 6 | public enum ReplaceAction {
|
---|
| 7 | Value,
|
---|
| 8 | Average,
|
---|
| 9 | Median,
|
---|
| 10 | Random,
|
---|
| 11 | MostCommon,
|
---|
| 12 | Interpolation
|
---|
| 13 | }
|
---|
| 14 |
|
---|
[10630] | 15 | public partial class FindAndReplaceDialog : Form {
|
---|
[10672] | 16 | private string[] cmbItemsText = { "Value", "Average", "Median", "Random", "Most Common", "Interpolation" };
|
---|
| 17 |
|
---|
[10630] | 18 | public FindAndReplaceDialog() {
|
---|
| 19 | InitializeComponent();
|
---|
[10672] | 20 | cmbReplaceWith.Items.AddRange(cmbItemsText);
|
---|
| 21 | cmbReplaceWith.SelectedIndex = (int)ReplaceAction.Value;
|
---|
[10630] | 22 | }
|
---|
| 23 |
|
---|
[10633] | 24 | public void ActivateSearch() {
|
---|
| 25 | tabSearch.Focus();
|
---|
[10636] | 26 | AddControlsToCurrentTab();
|
---|
[10633] | 27 | }
|
---|
| 28 |
|
---|
| 29 | public void ActivateReplace() {
|
---|
| 30 | tabReplace.Focus();
|
---|
[10636] | 31 | AddControlsToCurrentTab();
|
---|
[10633] | 32 | }
|
---|
| 33 |
|
---|
[10636] | 34 | private void tabSearchReplace_SelectedIndexChanged(object sender, System.EventArgs e) {
|
---|
| 35 | AddControlsToCurrentTab();
|
---|
[10630] | 36 | }
|
---|
| 37 |
|
---|
[10672] | 38 | private void cmbReplaceWith_SelectedIndexChanged(object sender, System.EventArgs e) {
|
---|
| 39 | lblValue.Visible = txtValue.Visible = cmbReplaceWith.SelectedIndex == (int)ReplaceAction.Value;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
[10636] | 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 |
|
---|
[10672] | 49 | public String GetSearchText() {
|
---|
[10636] | 50 | return txtSearchString.Text;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | public string GetReplaceText() {
|
---|
| 54 | return txtValue.Text;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
[10672] | 57 | public ReplaceAction GetReplaceAction() {
|
---|
| 58 | return (ReplaceAction)cmbReplaceWith.SelectedIndex;
|
---|
[10636] | 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 {
|
---|
[10672] | 77 | add { btnReplace.Click += value; }
|
---|
| 78 | remove { btnReplace.Click -= value; }
|
---|
[10636] | 79 | }
|
---|
| 80 |
|
---|
[10630] | 81 | }
|
---|
| 82 | }
|
---|