Windows: Add cursor waiting

This commit is contained in:
2023-09-06 18:04:13 +02:00
parent 540236f878
commit 7086a72fab
2 changed files with 40 additions and 12 deletions

View File

@ -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) {