[fix:] fixed new customer issue (new customer creation was terrible)

This commit is contained in:
Elias Fierke
2025-11-04 14:43:11 +01:00
parent fb671e3526
commit a70948599f

View File

@@ -265,8 +265,16 @@ public partial class MainWindow : Window
TbSettingsCustomerDescription.Text = "";
TbSettingsCustomerName.Text = "";
TbSettingsCustomerPatchInfo.Text = "";
//Settings.Save();
//RefreshCustomerItems();
Settings.Save();
RefreshCustomerItems();
try
{
LstSettingsCustomers.SelectedIndex = LstSettingsCustomers.Items.Count - 1;
}
catch
{
}
}
private void TbSettingsCustomerName_OnTextChanged(object? sender, TextChangedEventArgs e)
@@ -297,7 +305,7 @@ public partial class MainWindow : Window
}
}
public void RefreshCustomerItems()
public void RefreshCustomerItems(int index = 0)
{
if (LstCustomers.Items.Count > 0)
LstCustomers.SelectedIndex = -1;
@@ -316,6 +324,14 @@ public partial class MainWindow : Window
LstCustomers.Items.Add(customer.ID + " - " + customer.name);
LstSettingsCustomers.Items.Add(customer.ID + " - " + customer.name);
}
try
{
LstSettingsCustomers.SelectedIndex = index;
}
catch
{
}
}
private void TbSettingsCustomerDescription_OnTextChanged(object? sender, TextChangedEventArgs e)
@@ -330,7 +346,7 @@ public partial class MainWindow : Window
private void BtnSettingsSaveCustomerData_OnClick(object? sender, RoutedEventArgs e)
{
Settings.Save();
RefreshCustomerItems();
RefreshCustomerItems(LstSettingsCustomers.SelectedIndex);
}
private void LstCustomers_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)