[feat:] delete address sets (FINALLY, this was so hard to implement, it took almost 2 minutes)

This commit is contained in:
2026-05-19 09:31:35 +02:00
parent e2d5ae2a70
commit eb38bafd23
2 changed files with 26 additions and 1 deletions
+25
View File
@@ -1237,4 +1237,29 @@ public partial class MainWindow : Window
}
}
private async void MnIAdSetDelete_OnClick(object? sender, RoutedEventArgs e)
{
if(await MessageBox.Show(this,"Wirklich löschen?","",MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
var cus_id = ((Customer)LstCustomers.SelectedItems[0]).ID;
var id = (LstCustomerAdressSets.SelectedItems[0] as KasAddressList).ID;
try
{
foreach (var set in Settings._instance.addressSets.addresses)
if (set.ID == id)
{
Settings._instance.addressSets.addresses.Remove(set);
Settings.Save();
RefreshAddressSetListItems(cus_id);
break;
}
}
catch (Exception ex)
{
MessageBox.Show(this, ex.StackTrace, "Fehler");
Logger.Log($"Error while deleting address set: {ex.Message}", Logger.LogType.Error);
}}
}
}