[chore:] ui element disableing (customer settings)

This commit is contained in:
2026-05-27 08:42:25 +02:00
parent 0dacaf19b9
commit 1580d30d72
+12
View File
@@ -28,6 +28,7 @@ public partial class MainWindow : Window
Logger.Log($"Session on {DateTime.Now:G}"); Logger.Log($"Session on {DateTime.Now:G}");
Logger.Log("Initializing..."); Logger.Log("Initializing...");
InitializeComponent(); InitializeComponent();
SetSettingsCustomerEnabledState(false);
//Hide(); //Hide();
var s = new StartupWindow(); var s = new StartupWindow();
@@ -484,6 +485,7 @@ public partial class MainWindow : Window
private void LstSettingsCustomers_OnSelectionChanged(object? sender, SelectionChangedEventArgs e) private void LstSettingsCustomers_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
{ {
SetSettingsCustomerEnabledState(false);
if (LstSettingsCustomers.SelectedIndex < 0) return; if (LstSettingsCustomers.SelectedIndex < 0) return;
Settings._instance.customers.current = Settings._instance.customers.current =
((Customer)LstSettingsCustomers.SelectedItems[0]); ((Customer)LstSettingsCustomers.SelectedItems[0]);
@@ -498,9 +500,19 @@ public partial class MainWindow : Window
TbSettingsCustomerPatchInfo.Text = Settings._instance.customers.current.patch.ToString(); TbSettingsCustomerPatchInfo.Text = Settings._instance.customers.current.patch.ToString();
else else
TbSettingsCustomerPatchInfo.Text = ""; TbSettingsCustomerPatchInfo.Text = "";
SetSettingsCustomerEnabledState();
//} //}
} }
private void SetSettingsCustomerEnabledState(bool enable = true)
{
List<Object> 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) private async void EditButton_Click(object? sender, RoutedEventArgs e)
{ {
if (string.IsNullOrWhiteSpace(_selectedWikiFilePath)) if (string.IsNullOrWhiteSpace(_selectedWikiFilePath))