[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
+15 -11
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)
{ {
if (LstCustomerAdressSets.SelectedItems.Count > 0) var id = (LstCustomerAdressSets.SelectedItems[0] as KasAddressList).ID;
try
{
var result = await NamingWindow.Show(this);
if (result != null)
{
var id = KasAddressList.GetIDByAddressSetListItem(LstCustomerAdressSets.SelectedItems[0]
.ToString());
var cus_id = ((Customer)LstCustomers.SelectedItems[0]).ID; var cus_id = ((Customer)LstCustomers.SelectedItems[0]).ID;
var curr_set = new KasAddressList("");
foreach (var set in Settings._instance.addressSets.addresses) foreach (var set in Settings._instance.addressSets.addresses)
if (set.ID == id) if (set.ID == id)
{ {
set.Name = result; curr_set = set;
}
if (LstCustomerAdressSets.SelectedItems.Count > 0)
try
{
var result = await NamingWindow.Show(this, curr_set.Name);
if (result != null)
{
curr_set.Name = result;
Settings.Save(); Settings.Save();
RefreshAddressSetListItems(cus_id); RefreshAddressSetListItems(cus_id);
break; return;
}
} }
} }
catch (Exception ex) catch (Exception ex)