diff --git a/MainWindow.axaml.cs b/MainWindow.axaml.cs index 460ffbb..564c199 100644 --- a/MainWindow.axaml.cs +++ b/MainWindow.axaml.cs @@ -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)