File tree 1 file changed +4
-2
lines changed
RegexFileSearcher/RegexFileSearcher
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ public partial class MainForm : Form
19
19
20
20
private CancellationTokenSource _cancellationTokenSource ;
21
21
private Timer _updateTimer ;
22
+ private Color _defaultPanelBackgroundColor ;
22
23
private bool _matchNumberOrdering ;
23
24
private volatile bool _searchEnded = true ;
24
25
@@ -29,6 +30,7 @@ public MainForm() : this(initializeControls: true)
29
30
30
31
txtFileNameRegex . TextChanged += OnTextBoxChangedRegex ;
31
32
txtContentRegex . TextChanged += OnTextBoxChangedRegex ;
33
+ _defaultPanelBackgroundColor = txtFileNameRegex . Parent . Parent . BackgroundColor ;
32
34
}
33
35
34
36
private void OnTextBoxChangedRegex ( object sender , EventArgs e )
@@ -37,11 +39,11 @@ private void OnTextBoxChangedRegex(object sender, EventArgs e)
37
39
bool isContentRegexValid = ValidateRegex ( txtContentRegex ) ;
38
40
btnStartSearch . Enabled = isFileNameRegexValid && isContentRegexValid ;
39
41
40
- static bool ValidateRegex ( TextBox textBox )
42
+ bool ValidateRegex ( TextBox textBox )
41
43
{
42
44
bool isRegexValid = RegexValidator . IsRegexValid ( textBox . Text , out string errorMessage ) ;
43
45
textBox . ToolTip = isRegexValid ? null : errorMessage ;
44
- textBox . Parent . Parent . BackgroundColor = isRegexValid ? Colors . White : Colors . LightSalmon ;
46
+ textBox . Parent . Parent . BackgroundColor = isRegexValid ? _defaultPanelBackgroundColor : Colors . LightSalmon ;
45
47
return isRegexValid ;
46
48
}
47
49
}
You can’t perform that action at this time.
0 commit comments