[#16] DeleteMemberDialog: Highlight invalid/not-checked inputs
All checks were successful
Test / Run tests (push) Successful in 1m59s
All checks were successful
Test / Run tests (push) Successful in 1m59s
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
using System.Linq;
|
using Elwig.Helpers;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
@ -31,13 +32,30 @@ namespace Elwig.Dialogs {
|
|||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void UpdateCheckBox(CheckBox cb) {
|
||||||
|
if (cb.IsEnabled && cb.IsChecked != true) {
|
||||||
|
ControlUtils.SetInputInvalid(cb);
|
||||||
|
} else {
|
||||||
|
ControlUtils.ClearInputState(cb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Update() {
|
private void Update() {
|
||||||
var t = NameInput.Text.ToLower();
|
var t = NameInput.Text.ToLower();
|
||||||
|
var nameValid = NameParts.All(t.Contains);
|
||||||
|
UpdateCheckBox(AreaComInput);
|
||||||
|
UpdateCheckBox(DeliveryInput);
|
||||||
|
UpdateCheckBox(PaymentInput);
|
||||||
|
if (!nameValid) {
|
||||||
|
ControlUtils.SetInputInvalid(NameInput);
|
||||||
|
} else {
|
||||||
|
ControlUtils.ClearInputState(NameInput);
|
||||||
|
}
|
||||||
ConfirmButton.IsEnabled =
|
ConfirmButton.IsEnabled =
|
||||||
(!AreaComInput.IsEnabled || DeleteAreaComs) &&
|
(!AreaComInput.IsEnabled || DeleteAreaComs) &&
|
||||||
(!DeliveryInput.IsEnabled || DeleteDeliveries) &&
|
(!DeliveryInput.IsEnabled || DeleteDeliveries) &&
|
||||||
(!PaymentInput.IsEnabled || DeletePaymentData) &&
|
(!PaymentInput.IsEnabled || DeletePaymentData) &&
|
||||||
NameParts.All(t.Contains);
|
nameValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
|
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
Reference in New Issue
Block a user