[feat:] delete address sets (FINALLY, this was so hard to implement, it took almost 2 minutes)
This commit is contained in:
@@ -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);
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user