From 474b628f0bca0d20e5541ee27c507d03831bc385 Mon Sep 17 00:00:00 2001 From: Elias Fierke Date: Fri, 15 May 2026 17:51:35 +0200 Subject: [PATCH] [chore:] renaming address sets now gives the current name as a base --- MainWindow.axaml.cs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/MainWindow.axaml.cs b/MainWindow.axaml.cs index cb6c1f4..26370b1 100644 --- a/MainWindow.axaml.cs +++ b/MainWindow.axaml.cs @@ -1070,23 +1070,27 @@ public partial class MainWindow : Window private async void MnIAdSetRename_OnClick(object? sender, RoutedEventArgs e) { + var id = (LstCustomerAdressSets.SelectedItems[0] as KasAddressList).ID; + var cus_id = ((Customer)LstCustomers.SelectedItems[0]).ID; + var curr_set = new KasAddressList(""); + foreach (var set in Settings._instance.addressSets.addresses) + if (set.ID == id) + { + curr_set = set; + + } + + if (LstCustomerAdressSets.SelectedItems.Count > 0) try { - var result = await NamingWindow.Show(this); + var result = await NamingWindow.Show(this, curr_set.Name); if (result != null) { - var id = KasAddressList.GetIDByAddressSetListItem(LstCustomerAdressSets.SelectedItems[0] - .ToString()); - var cus_id = ((Customer)LstCustomers.SelectedItems[0]).ID; - foreach (var set in Settings._instance.addressSets.addresses) - if (set.ID == id) - { - set.Name = result; - Settings.Save(); - RefreshAddressSetListItems(cus_id); - break; - } + curr_set.Name = result; + Settings.Save(); + RefreshAddressSetListItems(cus_id); + return; } } catch (Exception ex)