MainWindow: Cleanup and move parts to TestWindow
This commit is contained in:
@ -1,16 +1,26 @@
|
||||
using Elwig.Documents;
|
||||
using Elwig.Helpers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Xceed.Wpf.Toolkit.Primitives;
|
||||
|
||||
namespace Elwig.Windows {
|
||||
public partial class TestWindow : Window {
|
||||
|
||||
public TestWindow() {
|
||||
InitializeComponent();
|
||||
MyComboBox.ItemsSource = new string[] { "Klasse A" , "Klasse B", "Klasse C", "Klasse D", "Klasse E", "Klasse F" };
|
||||
MyListBox.ItemsSource = new string[] { "Test 1", "Test 2", "Test 3", "Test 4" };
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs evt) {
|
||||
PdfDeliveryButton.IsEnabled = App.IsPrintingReady;
|
||||
PdfCreditButton.IsEnabled = App.IsPrintingReady;
|
||||
}
|
||||
|
||||
private void OnItemSelectionChanged(object sender, ItemSelectionChangedEventArgs e) {
|
||||
MyText.Text = string.Join(", ", MyComboBox.SelectedItems.Cast<string>());
|
||||
}
|
||||
@ -39,5 +49,23 @@ namespace Elwig.Windows {
|
||||
var w = new ChartWindow();
|
||||
w.Show();
|
||||
}
|
||||
|
||||
private async void PdfDeliveryButton_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 async void PdfCreditButton_Click(object sender, RoutedEventArgs evt) {
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
using var ctx = new AppDbContext();
|
||||
using var doc = new CreditNote(await ctx.Credits.FirstAsync(), ctx);
|
||||
await doc.Generate();
|
||||
doc.Show();
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user