Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.BioBoost/HeuristicLab.Problems.BioBoost.Views/3.3/FilterDialog.cs @ 13073

Last change on this file since 13073 was 13072, checked in by gkronber, 9 years ago

#2499: added code from HeuristicLab.BioBoost.Views (from private repository) nothing much has been changed

File size: 1.8 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Globalization;
7using System.Linq;
8using System.Text;
9using System.Text.RegularExpressions;
10using System.Windows.Forms;
11using System.Windows.Forms.VisualStyles;
12
13namespace HeuristicLab.BioBoost.Views {
14  public partial class FilterDialog : Form {
15
16    public Regex Regex { get; private set; }
17    public bool Keep { get; private set; }
18
19    public FilterDialog() {
20      InitializeComponent();
21      Keep = true;
22    }
23
24    protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
25      if (keyData == Keys.Enter) {
26        DialogResult = DialogResult.OK;
27        Close();
28        return true;
29      } else if (keyData == Keys.Escape) {
30        DialogResult = DialogResult.Cancel;
31        Close();
32        return true;
33      }
34      return base.ProcessCmdKey(ref msg, keyData);
35    }
36
37    private void textBox1_Validating(object sender, CancelEventArgs e) {
38      try {
39        Regex = new Regex(textBox1.Text, RegexOptions.IgnoreCase|RegexOptions.IgnorePatternWhitespace);
40      } catch (ArgumentException x) {
41        textBox1.Select(0, textBox1.Text.Length);
42        e.Cancel = true;
43        errorProvider1.SetError(textBox1, "not a valid regular expression.");
44      }
45    }
46
47    private void textBox1_Validated(object sender, EventArgs e) {
48      errorProvider1.SetError(textBox1, "");
49    }
50
51    private void cancelButton_Click(object sender, EventArgs e) {
52      DialogResult = DialogResult.Cancel;
53      Close();
54    }
55
56    private void okButton_Click(object sender, EventArgs e) {
57      DialogResult = DialogResult.OK;
58      Close();
59    }
60
61    private void keepOption_CheckedChanged(object sender, EventArgs e) {
62      Keep = keepOption.Checked;
63    }
64
65
66  }
67}
Note: See TracBrowser for help on using the repository browser.