[chore:] renaming address sets now gives the current name as a base

This commit is contained in:
2026-05-15 17:51:35 +02:00
parent 7fe45ce4e3
commit 474b628f0b
+16 -12
View File
@@ -1070,23 +1070,27 @@ public partial class MainWindow : Window
private async void MnIAdSetRename_OnClick(object? sender, RoutedEventArgs e) 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) if (LstCustomerAdressSets.SelectedItems.Count > 0)
try try
{ {
var result = await NamingWindow.Show(this); var result = await NamingWindow.Show(this, curr_set.Name);
if (result != null) if (result != null)
{ {
var id = KasAddressList.GetIDByAddressSetListItem(LstCustomerAdressSets.SelectedItems[0] curr_set.Name = result;
.ToString()); Settings.Save();
var cus_id = ((Customer)LstCustomers.SelectedItems[0]).ID; RefreshAddressSetListItems(cus_id);
foreach (var set in Settings._instance.addressSets.addresses) return;
if (set.ID == id)
{
set.Name = result;
Settings.Save();
RefreshAddressSetListItems(cus_id);
break;
}
} }
} }
catch (Exception ex) catch (Exception ex)