[chore:] big code-cleanup session
This commit is contained in:
+5
-62
@@ -21,27 +21,20 @@ public partial class ResultWindow : Window
|
||||
{
|
||||
InitializeComponent();
|
||||
ur_result = result;
|
||||
ur_addresses = ur_addresses;
|
||||
|
||||
Load(result);
|
||||
//ViewSingle(200552426);
|
||||
}
|
||||
|
||||
private void GenerateView(List<KasPerson> result)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
// Filter to only show persons with errors
|
||||
var result_with_errors = result.Where(p => p.PersonError != null).ToList();
|
||||
LblResultCount.Content = $"{result_with_errors.Count}/{ur_result.Count} Ergebnisse";
|
||||
|
||||
// TbResults.Text = "";
|
||||
// foreach (var person in result_with_errors) TbResults.Text += person.PersonError.GetString()+"\n";
|
||||
LbResults.Items.Clear();
|
||||
foreach (var person in result_with_errors) LbResults.Items.Add(person.PersonError.ToString(person));
|
||||
// StkResults.Children.Clear();
|
||||
// foreach (var person in result_with_errors) StkResults.Children.Add(CreatePersonGrid(person));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -49,40 +42,6 @@ public partial class ResultWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
private Grid CreatePersonGrid(KasPerson person)
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("100,*,100,*,100,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto"),
|
||||
Margin = new Thickness(0, 5, 0, 5),
|
||||
Background = new SolidColorBrush(Color.Parse("#F0F0F0"))
|
||||
};
|
||||
|
||||
// ID
|
||||
grid.Children.Add(new TextBlock
|
||||
{
|
||||
Text = "id: ",
|
||||
FontWeight = FontWeight.Bold, Margin = new Thickness(5)
|
||||
});
|
||||
grid.Children.Add(new TextBlock { Text = person.id.ToString(), Margin = new Thickness(5) });
|
||||
Grid.SetColumn(grid.Children[1], 1);
|
||||
|
||||
// PLZ
|
||||
grid.Children.Add(new TextBlock { Text = "plz:", FontWeight = FontWeight.Bold, Margin = new Thickness(5) });
|
||||
Grid.SetColumn(grid.Children[2], 2);
|
||||
grid.Children.Add(new TextBlock { Text = person.plz, Margin = new Thickness(5) });
|
||||
Grid.SetColumn(grid.Children[3], 3);
|
||||
|
||||
// PPLZ
|
||||
grid.Children.Add(new TextBlock { Text = "errors:", FontWeight = FontWeight.Bold, Margin = new Thickness(5) });
|
||||
Grid.SetColumn(grid.Children[4], 4);
|
||||
grid.Children.Add(new TextBlock { Text = person.PersonError.GetString(), Margin = new Thickness(5) });
|
||||
Grid.SetColumn(grid.Children[5], 5);
|
||||
|
||||
return grid;
|
||||
}
|
||||
|
||||
private void ViewSingle(int id)
|
||||
{
|
||||
foreach (var result in ur_addresses.KasPersons)
|
||||
@@ -139,7 +98,7 @@ public partial class ResultWindow : Window
|
||||
var cb = new CheckBox();
|
||||
cb.IsChecked = true;
|
||||
cb.Content = errtype.ToString();
|
||||
//cb.Click += (sender, e) => UpdateFilter();
|
||||
|
||||
errortypecheckboxes.Add(cb);
|
||||
StpFilterOptions.Children.Add(cb);
|
||||
}
|
||||
@@ -149,7 +108,7 @@ public partial class ResultWindow : Window
|
||||
var cb = new CheckBox();
|
||||
cb.IsChecked = true;
|
||||
cb.Content = wartype.ToString();
|
||||
//cb.Click += (sender, e) => UpdateFilter();
|
||||
|
||||
warningtypecheckboxes.Add(cb);
|
||||
StpFilterOptions.Children.Add(cb);
|
||||
}
|
||||
@@ -163,10 +122,6 @@ public partial class ResultWindow : Window
|
||||
|
||||
}
|
||||
|
||||
private void BtnUpdateFilter_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void UpdateFilter()
|
||||
{
|
||||
try
|
||||
@@ -226,10 +181,7 @@ public partial class ResultWindow : Window
|
||||
|
||||
LbResults.Items.Clear();
|
||||
foreach (var person in temp_result) LbResults.Items.Add(person.PersonError.ToString(person));
|
||||
// TbResults.Text = "";
|
||||
// foreach (var person in temp_result) TbResults.Text += person.PersonError.GetString() +"\n";
|
||||
// StkResults.Children.Clear();
|
||||
// foreach (var person in temp_result) StkResults.Children.Add(CreatePersonGrid(person));
|
||||
|
||||
} catch (Exception ex)
|
||||
{
|
||||
Logger.Log("Error while updating filter: " + ex.Message, Logger.LogType.Warning);
|
||||
@@ -240,16 +192,7 @@ public partial class ResultWindow : Window
|
||||
|
||||
private void BtnShowSelected_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
// foreach (var selected in DgResult.SelectedItems)
|
||||
// try
|
||||
// {
|
||||
// var _asKas = (KasPerson)selected;
|
||||
// ViewSingle(_asKas.id);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Console.WriteLine(ex.Message);
|
||||
// }
|
||||
// once upon a time, there was a feature like this
|
||||
}
|
||||
|
||||
private void BtnExecuteFilter_OnClick(object? sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user