mirror of
https://github.com/wmjordan/PDFPatcher.git
synced 2026-10-19 06:21:06 +08:00
7d279bc324
!重构代码
57 lines
1.3 KiB
C#
57 lines
1.3 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Windows.Forms;
|
|
using PDFPatcher.Model;
|
|
|
|
namespace PDFPatcher.Functions
|
|
{
|
|
[ToolboxItem(false)]
|
|
sealed partial class TextConditionEditor : UserControl, IFilterConditionEditor
|
|
{
|
|
AutoBookmarkCondition.TextCondition _filter;
|
|
bool _lock;
|
|
|
|
public TextConditionEditor() {
|
|
InitializeComponent();
|
|
}
|
|
|
|
#region ITextInfoFilterEditor 成员
|
|
public UserControl EditorControl => this;
|
|
|
|
public AutoBookmarkCondition Filter {
|
|
get => _filter;
|
|
set {
|
|
_filter = (AutoBookmarkCondition.TextCondition)value;
|
|
_lock = true;
|
|
_PatternBox.Text = _filter.Pattern.Text;
|
|
_FullMatchBox.Checked = _filter.Pattern.FullMatch;
|
|
_MatchCaseBox.Checked = _filter.Pattern.MatchCase;
|
|
_UseRegexBox.Checked = _filter.Pattern.UseRegularExpression;
|
|
_lock = false;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
void ControlChanged(object sender, EventArgs e) {
|
|
if (_lock) {
|
|
return;
|
|
}
|
|
|
|
if (sender == _PatternBox) {
|
|
_filter.Pattern.Text = _PatternBox.Text;
|
|
}
|
|
else if (sender == _FullMatchBox) {
|
|
_filter.Pattern.FullMatch = _FullMatchBox.Checked;
|
|
}
|
|
else if (sender == _MatchCaseBox) {
|
|
_filter.Pattern.MatchCase = _MatchCaseBox.Checked;
|
|
}
|
|
else if (sender == _UseRegexBox) {
|
|
_filter.Pattern.UseRegularExpression = _UseRegexBox.Checked;
|
|
}
|
|
EditAdjustmentForm.UpdateFilter(this);
|
|
}
|
|
}
|
|
}
|