43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using Elwig.Documents;
|
|
using Elwig.Helpers;
|
|
|
|
namespace Elwig.Windows {
|
|
public partial class MainWindow : Window {
|
|
private readonly AppDbContext Context = new();
|
|
|
|
public MainWindow() {
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs evt) {
|
|
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();
|
|
}
|
|
|
|
private void Button3_Click(object sender, RoutedEventArgs evt) {
|
|
var w = new MemberListWindow();
|
|
w.Show();
|
|
}
|
|
|
|
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());
|
|
await doc.Generate();
|
|
doc.Show();
|
|
});
|
|
}
|
|
}
|
|
}
|