Update Main Window

This commit is contained in:
2023-04-28 15:10:31 +02:00
parent 0dfb42a5ce
commit 4b52af6fe9
4 changed files with 35 additions and 10 deletions

@ -6,7 +6,6 @@ using Elwig.Helpers;
namespace Elwig.Windows {
public partial class MainWindow : Window {
private readonly AppDbContext Context = new();
public MainWindow() {
InitializeComponent();
@ -16,11 +15,6 @@ namespace Elwig.Windows {
Button4.IsEnabled = App.IsPrintingReady;
}
protected override void OnClosing(CancelEventArgs evt) {
Context.Dispose();
base.OnClosing(evt);
}
private void Button2_Click(object sender, RoutedEventArgs evt) {
var w = new MemberAdminWindow();
w.Show();
@ -33,7 +27,8 @@ namespace Elwig.Windows {
private void Button4_Click(object sender, RoutedEventArgs evt) {
Utils.RunBackground("PDF Generation", async () => {
using var doc = new DeliveryNote(Context.Deliveries.OrderBy(d => d.Year).ThenBy(d => d.DId).Last());
using var ctx = new AppDbContext();
using var doc = new DeliveryNote(ctx.Deliveries.OrderBy(d => d.Parts.Count).ThenBy(d => d.Year).ThenBy(d => d.DId).Last());
await doc.Generate();
doc.Show();
});