Update Main Window
This commit is contained in:
@ -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();
|
||||
});
|
||||
|
Reference in New Issue
Block a user