diff --git a/Elwig/Dialogs/DeleteMemberDialog.xaml.cs b/Elwig/Dialogs/DeleteMemberDialog.xaml.cs index cdfb7ca..06494bf 100644 --- a/Elwig/Dialogs/DeleteMemberDialog.xaml.cs +++ b/Elwig/Dialogs/DeleteMemberDialog.xaml.cs @@ -1,4 +1,5 @@ -using System.Linq; +using Elwig.Helpers; +using System.Linq; using System.Windows; using System.Windows.Controls; @@ -31,13 +32,30 @@ namespace Elwig.Dialogs { Update(); } + private static void UpdateCheckBox(CheckBox cb) { + if (cb.IsEnabled && cb.IsChecked != true) { + ControlUtils.SetInputInvalid(cb); + } else { + ControlUtils.ClearInputState(cb); + } + } + private void Update() { 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 = (!AreaComInput.IsEnabled || DeleteAreaComs) && (!DeliveryInput.IsEnabled || DeleteDeliveries) && (!PaymentInput.IsEnabled || DeletePaymentData) && - NameParts.All(t.Contains); + nameValid; } private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {