[feat:] filtering feature for result window

This commit is contained in:
Elias Fierke
2025-07-09 23:34:10 +02:00
parent 818122e449
commit 79e454fa07
5 changed files with 61 additions and 6 deletions

View File

@@ -5,7 +5,14 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Logof_Client.ResultWindow"
Title="Ergebnis">
<Grid Grid.ColumnDefinitions="200,*">
<Grid>
<DataGrid x:Name="DgResult" AutoGenerateColumns="True" />
<Label Content="Filter" Margin="10,10,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
<StackPanel x:Name="StpFilterOptions" Orientation="Vertical" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Margin="10,40,10,50" />
<Button x:Name="BtnUpdateFilter" Content="Aktualisieren" HorizontalAlignment="Stretch"
VerticalAlignment="Bottom" Margin="10,0,10,10" Click="BtnUpdateFilter_OnClick" />
</Grid>
<DataGrid x:Name="DgResult" Grid.Column="1" AutoGenerateColumns="True" />
</Grid>
</Window>

View File

@@ -1,20 +1,68 @@
using System;
using System.Collections.Generic;
using Avalonia.Controls;
using Avalonia.Interactivity;
namespace Logof_Client;
public partial class ResultWindow : Window
{
public List<CheckBox> errortypecheckboxes = new();
public List<(int, List<AddressCheck.ErrorTypes>)> ur_result;
public ResultWindow(List<(int, List<AddressCheck.ErrorTypes>)> result)
{
InitializeComponent();
GenerateView(result);
Load(result);
ur_result = result;
}
private void GenerateView(List<(int, List<AddressCheck.ErrorTypes>)> result)
{
var errors = new List<KasPersonError>();
foreach (var single_result in result) errors.Add(new KasPersonError(single_result));
DgResult.ItemsSource = errors;
}
private void Load(List<(int, List<AddressCheck.ErrorTypes>)> result)
{
var knownErrors = new List<AddressCheck.ErrorTypes>();
foreach (var single_result in result)
foreach (var errtyp in single_result.Item2)
if (!knownErrors.Contains(errtyp))
knownErrors.Add(errtyp);
foreach (var errtype in knownErrors)
{
var cb = new CheckBox();
cb.IsChecked = true;
cb.Content = errtype.ToString();
errortypecheckboxes.Add(cb);
StpFilterOptions.Children.Add(cb);
}
GenerateView(result);
}
private void BtnUpdateFilter_OnClick(object? sender, RoutedEventArgs e)
{
var temp_result = new List<(int, List<AddressCheck.ErrorTypes>)>();
var checked_types = new List<AddressCheck.ErrorTypes>();
foreach (var cb in errortypecheckboxes)
if (cb.IsChecked == true)
checked_types.Add(
(AddressCheck.ErrorTypes)Enum.Parse(typeof(AddressCheck.ErrorTypes), cb.Content.ToString()));
foreach (var sres in ur_result)
foreach (var err in sres.Item2)
if (checked_types.Contains(err))
temp_result.Add(sres);
var errors = new List<KasPersonError>();
foreach (var single_result in temp_result) errors.Add(new KasPersonError(single_result));
DgResult.ItemsSource = errors;
}
}

Binary file not shown.

View File

@@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Logof Client")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4bdf50a290804aab4f6671c7ded546f168c8e674")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+66398406d3a9a202e9666c13ef754f1f2a95411a")]
[assembly: System.Reflection.AssemblyProductAttribute("Logof Client")]
[assembly: System.Reflection.AssemblyTitleAttribute("Logof Client")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
// Von der MSBuild WriteCodeFragment-Klasse generiert.

View File

@@ -1 +1 @@
f7afc36fe250c56352855cc054140e1d3e759a80e43f866429a6f585b3dd52ae
1f491fc36ae96a90792cc9487efec52e69b87de0be7163511918f5e90a36a992