Move input states from Validator to Utils

This commit is contained in:
2023-02-27 23:09:26 +01:00
parent f13896d59a
commit 93a9418ad2
3 changed files with 28 additions and 27 deletions

View File

@ -82,13 +82,13 @@ namespace WGneu.Windows {
private void ClearInputStates() {
foreach (var tb in Utils.FindVisualChilds<TextBox>(this))
if (tb.Name != "SearchInput") Validator.ClearInputStatus(tb);
if (tb.Name != "SearchInput") Utils.ClearInputState(tb);
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
Validator.ClearInputStatus(cb);
Utils.ClearInputState(cb);
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
Validator.ClearInputStatus(cb);
Utils.ClearInputState(cb);
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
Validator.ClearInputStatus(rb);
Utils.ClearInputState(rb);
}
private void RefreshInputs() {
@ -439,12 +439,12 @@ namespace WGneu.Windows {
Valid[input] = res.IsValid;
if (res.IsValid) {
if (InputHasChanged(input)) {
Validator.SetInputChanged(input);
Utils.SetInputChanged(input);
} else {
Validator.ClearInputStatus(input);
Utils.ClearInputState(input);
}
} else {
Validator.SetInputInvalid(input);
Utils.SetInputInvalid(input);
}
UpdateButtons();
}
@ -458,9 +458,9 @@ namespace WGneu.Windows {
private void CheckBox_Changed(object sender, RoutedEventArgs e) {
var input = (CheckBox)sender;
if (InputHasChanged(input)) {
Validator.SetInputChanged(input);
Utils.SetInputChanged(input);
} else {
Validator.ClearInputStatus(input);
Utils.ClearInputState(input);
}
UpdateButtons();
}
@ -468,9 +468,9 @@ namespace WGneu.Windows {
private void RadioButton_Changed(object sender, RoutedEventArgs e) {
var input = (RadioButton)sender;
if (InputHasChanged(input)) {
Validator.SetInputChanged(input);
Utils.SetInputChanged(input);
} else {
Validator.ClearInputStatus(input);
Utils.ClearInputState(input);
}
UpdateButtons();
}
@ -478,9 +478,9 @@ namespace WGneu.Windows {
private void TextBox_TextChanged(object sender, RoutedEventArgs e) {
var input = (TextBox)sender;
if (InputHasChanged(input)) {
Validator.SetInputChanged(input);
Utils.SetInputChanged(input);
} else {
Validator.ClearInputStatus(input);
Utils.ClearInputState(input);
}
UpdateButtons();
}
@ -489,9 +489,9 @@ namespace WGneu.Windows {
var input = (ComboBox)sender;
if (InputHasChanged(input)) {
// TODO not working
Validator.SetInputChanged(input);
Utils.SetInputChanged(input);
} else {
Validator.ClearInputStatus(input);
Utils.ClearInputState(input);
}
UpdateButtons();
}