From 8af9856afac11645e0e0d5bdbf24b16b869ea016 Mon Sep 17 00:00:00 2001 From: Elias Fierke Date: Sat, 4 Oct 2025 14:29:02 +0200 Subject: [PATCH] [fix:] Import with AddressPatch hasn't been called --- MainWindow.axaml.cs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/MainWindow.axaml.cs b/MainWindow.axaml.cs index 1f5b460..376955e 100644 --- a/MainWindow.axaml.cs +++ b/MainWindow.axaml.cs @@ -317,7 +317,24 @@ public partial class MainWindow : Window foreach (var customer in Settings._instance.customers.customers) if (customer.ID == Customer.GetIDByCustomerListItem(LstCustomers.SelectedItems[0].ToString())) + { if (customer.patch == null) + { + var got = DataImport.ImportKasAddressList(selected_path); + if (!got.Item1) + { + Console.WriteLine("Error while importing. Please try another file."); + } + else + { + got.Item2.SetOwner(customer.ID); + Settings._instance.addressSets.addresses.Add(got.Item2); + } + + //var customer_id = int.Parse(LstCustomers.SelectedItem.ToString().Split(" - ")[0]); + RefreshAddressSetListItems(customer.ID); + } + else { var got = DataImport.ImportKasAddressList(selected_path, customer.patch); if (!got.Item1) @@ -330,9 +347,11 @@ public partial class MainWindow : Window Settings._instance.addressSets.addresses.Add(got.Item2); } - var customer_id = int.Parse(LstCustomers.SelectedItem.ToString().Split(" - ")[0]); - RefreshAddressSetListItems(customer_id); + //var customer_id = int.Parse(LstCustomers.SelectedItem.ToString().Split(" - ")[0]); + RefreshAddressSetListItems(customer.ID); } + } + Settings.Save(); } @@ -386,7 +405,7 @@ public partial class MainWindow : Window if (paths?.Count <= 0) return; - if (LstSettingsCustomers.SelectedIndex < 0) return; + //if (LstSettingsCustomers.SelectedIndex < 0) return; var selected_path = paths[0].Path;