Windows: Add cursor waiting
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Elwig.Documents;
|
||||
using Elwig.Helpers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Elwig.Windows {
|
||||
public partial class MainWindow : Window {
|
||||
@ -38,13 +40,13 @@ namespace Elwig.Windows {
|
||||
// TODO
|
||||
}
|
||||
|
||||
private void PdfButton_Click(object sender, RoutedEventArgs evt) {
|
||||
Utils.RunBackground("PDF Generation", async () => {
|
||||
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(), ctx);
|
||||
await doc.Generate();
|
||||
doc.Show();
|
||||
});
|
||||
private async void PdfButton_Click(object sender, RoutedEventArgs evt) {
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
using var ctx = new AppDbContext();
|
||||
using var doc = new DeliveryNote(await ctx.Deliveries.OrderBy(d => d.Parts.Count).ThenBy(d => d.Year).ThenBy(d => d.DId).LastAsync(), ctx);
|
||||
await doc.Generate();
|
||||
doc.Show();
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
|
||||
private void TestWindowButton_Click(object sender, RoutedEventArgs evt) {
|
||||
|
Reference in New Issue
Block a user