[feat:] (opt) delete original sets after merging
This commit is contained in:
+7
-3
@@ -220,14 +220,18 @@
|
||||
</StackPanel>
|
||||
<Label FontSize="9" Content="Nur Elemente, die NICHT doppelt sind" />
|
||||
</StackPanel>
|
||||
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="50">
|
||||
<StackPanel Orientation="Vertical" >
|
||||
<RadioButton Content="Vergleiche nach refsid" IsChecked="True" x:Name="RbComprefsid"></RadioButton>
|
||||
<RadioButton Content="Vergleiche nach finaler Adresse" IsChecked="False" x:Name="RbCompfinAd"></RadioButton>
|
||||
</StackPanel>
|
||||
<CheckBox HorizontalAlignment="Center" x:Name="CbMergeExportUnmerged" IsChecked="False">Speichere Unverarbeitete in neuem Verteiler</CheckBox>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<CheckBox HorizontalAlignment="Left" x:Name="CbMergeExportUnmerged" IsChecked="False">Speichere Unverarbeitete in neuem Verteiler</CheckBox>
|
||||
<CheckBox HorizontalAlignment="Left" x:Name="CbMergeDeleteOld" IsChecked="False">Lösche ursprüngliche Sets</CheckBox>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Row="2" Margin="20" ColumnDefinitions="*,5*,*" IsVisible="False" x:Name="GrdExportMarginOptions">
|
||||
|
||||
+1
-1
@@ -391,7 +391,7 @@ public partial class MainWindow : Window
|
||||
progressWindow.Show(_instance);
|
||||
|
||||
var processor = new CombineAddresses(progressWindow);
|
||||
var result = await processor.Perform(address_lists, type, comb_type, CbMergeExportUnmerged.IsChecked);
|
||||
var result = await processor.Perform(address_lists, type, comb_type, CbMergeExportUnmerged.IsChecked, CbMergeDeleteOld.IsChecked);
|
||||
|
||||
if (result.Item1 != null)
|
||||
result.Item1.owner_id = owner_id;
|
||||
|
||||
@@ -24,13 +24,29 @@ public class CombineAddresses
|
||||
}
|
||||
|
||||
public async Task<(KasAddressList, KasAddressList)> Perform(List<KasAddressList> address_lists, string type, CombineType comb_type,
|
||||
bool? exportUnused, bool? deleteOld)
|
||||
{
|
||||
var result = await Execute(address_lists,type,comb_type,exportUnused);
|
||||
|
||||
if (deleteOld == true)
|
||||
{
|
||||
foreach (var list in address_lists)
|
||||
{
|
||||
Settings._instance.addressSets.addresses.Remove(list);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private async Task<(KasAddressList, KasAddressList)> Execute(List<KasAddressList> address_lists, string type, CombineType comb_type,
|
||||
bool? exportUnused)
|
||||
{
|
||||
if (type == "difference") return await Difference(address_lists, comb_type, exportUnused);
|
||||
if (type == "union") return await Union(address_lists, comb_type, exportUnused);
|
||||
if (type == "intersection") return await Intersection(address_lists, comb_type, exportUnused);
|
||||
if (type == "symdiff") return await SymmetricDifference(address_lists, comb_type, exportUnused);
|
||||
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user