diff --git a/MainWindow.axaml.cs b/MainWindow.axaml.cs index 06f8230..4adcff6 100644 --- a/MainWindow.axaml.cs +++ b/MainWindow.axaml.cs @@ -28,6 +28,7 @@ public partial class MainWindow : Window Logger.Log($"Session on {DateTime.Now:G}"); Logger.Log("Initializing..."); InitializeComponent(); + SetSettingsCustomerEnabledState(false); //Hide(); var s = new StartupWindow(); @@ -484,6 +485,7 @@ public partial class MainWindow : Window private void LstSettingsCustomers_OnSelectionChanged(object? sender, SelectionChangedEventArgs e) { + SetSettingsCustomerEnabledState(false); if (LstSettingsCustomers.SelectedIndex < 0) return; Settings._instance.customers.current = ((Customer)LstSettingsCustomers.SelectedItems[0]); @@ -498,9 +500,19 @@ public partial class MainWindow : Window TbSettingsCustomerPatchInfo.Text = Settings._instance.customers.current.patch.ToString(); else TbSettingsCustomerPatchInfo.Text = ""; + SetSettingsCustomerEnabledState(); //} } + private void SetSettingsCustomerEnabledState(bool enable = true) + { + List nboom = new() { BtnSettingsImportCustomerAddressPatch, GrdCSVDividerButtonsAndTb, TbSettingsCustomerDescription, TbSettingsCustomerName, BtnDeleteCustomer, TbSettingsCustomerSenderAddress}; + foreach (var obj in nboom) + { + (obj as Control).IsEnabled = enable; + } + } + private async void EditButton_Click(object? sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(_selectedWikiFilePath))