[feat:] address set combining order

This commit is contained in:
2026-08-02 16:17:42 +02:00
parent 59e7d96131
commit 81ee99ef27
2 changed files with 83 additions and 5 deletions
+65 -4
View File
@@ -669,6 +669,15 @@ public partial class MainWindow : Window
BtnRepair.IsEnabled = false;
}
}
LstCombineAddressSetSort.Items.Clear();
foreach (var selected in LstCustomerAdressSets.SelectedItems)
{
try
{
LstCombineAddressSetSort.Items.Add(selected as KasAddressList);
} catch {}
}
}
private async void BtnSettingsImportCustomerAddressPatch_OnClick(object? sender, RoutedEventArgs e)
@@ -728,7 +737,7 @@ public partial class MainWindow : Window
private void BtnCombineDifference_OnClick(object? sender, RoutedEventArgs e)
{
var list = new List<KasAddressList>();
foreach (var item in LstCustomerAdressSets.SelectedItems)
foreach (var item in LstCombineAddressSetSort.Items)
list.Add((KasAddressList)item);
try
{
@@ -743,7 +752,7 @@ public partial class MainWindow : Window
private void BtnCombineUnion_OnClick(object? sender, RoutedEventArgs e)
{
var list = new List<KasAddressList>();
foreach (var item in LstCustomerAdressSets.SelectedItems)
foreach (var item in LstCombineAddressSetSort.Items)
list.Add((KasAddressList)item);
try
{
@@ -759,7 +768,7 @@ public partial class MainWindow : Window
private void BtnCombineIntersection_OnClick(object? sender, RoutedEventArgs e)
{
var list = new List<KasAddressList>();
foreach (var item in LstCustomerAdressSets.SelectedItems)
foreach (var item in LstCombineAddressSetSort.Items)
list.Add((KasAddressList)item);
try
{
@@ -788,7 +797,7 @@ public partial class MainWindow : Window
private void BtnCombineSymmetricDifference_OnClick(object? sender, RoutedEventArgs e)
{
var list = new List<KasAddressList>();
foreach (var item in LstCustomerAdressSets.SelectedItems)
foreach (var item in LstCombineAddressSetSort.Items)
list.Add((KasAddressList)item);
StartCombine(list, Convert.ToInt32((LstCustomers.SelectedItem as Customer).ID), "symdiff", GetCombiningTyp());
@@ -1301,4 +1310,56 @@ public partial class MainWindow : Window
StartAddressRepairer((KasAddressList)LstCustomerAdressSets.SelectedItem);
}
private void BtnCombineAddressSetSortUp_OnClick(object? sender, RoutedEventArgs e)
{
var selected = (LstCombineAddressSetSort.SelectedItem as KasAddressList);
int index = LstCombineAddressSetSort.SelectedIndex;
if (LstCombineAddressSetSort.SelectedIndex != null && LstCombineAddressSetSort.SelectedIndex != -1)
{
try
{
LstCombineAddressSetSort.Items.RemoveAt(index);
LstCombineAddressSetSort.Items.Insert(index-1, selected);
LstCombineAddressSetSort.SelectedIndex = index - 1;
} catch {}
}
}
private void BtnCombineAddressSetSortDown_OnClick(object? sender, RoutedEventArgs e)
{
var selected = (LstCombineAddressSetSort.SelectedItem as KasAddressList);
int index = LstCombineAddressSetSort.SelectedIndex;
if (LstCombineAddressSetSort.SelectedIndex != null && LstCombineAddressSetSort.SelectedIndex != -1)
{
try
{
LstCombineAddressSetSort.Items.RemoveAt(index);
LstCombineAddressSetSort.Items.Insert(index+1, selected);
LstCombineAddressSetSort.SelectedIndex = index + 1;
} catch {}
}
}
private void LstCombineAddressSetSort_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
if (LstCombineAddressSetSort.SelectedIndex == 0)
{
BtnCombineAddressSetSortDown.IsEnabled = true;
BtnCombineAddressSetSortUp.IsEnabled = false;
} else if (LstCombineAddressSetSort.SelectedIndex == LstCombineAddressSetSort.Items.Count - 1)
{
BtnCombineAddressSetSortUp.IsEnabled = true;
BtnCombineAddressSetSortDown.IsEnabled = false;
} else if (LstCombineAddressSetSort.SelectedIndex == LstCombineAddressSetSort.Items.Count - 1 && LstCombineAddressSetSort.SelectedIndex == 0)
{
BtnCombineAddressSetSortUp.IsEnabled = false;
BtnCombineAddressSetSortDown.IsEnabled = false;
}
else
{
BtnCombineAddressSetSortDown.IsEnabled = true;
BtnCombineAddressSetSortUp.IsEnabled = true;
}
}
}