This commit is contained in:
2023-03-09 21:17:46 +01:00
parent 3b53fa599a
commit 69d5110735
6 changed files with 18 additions and 69 deletions

View File

@ -15,23 +15,20 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WGneu.Documents;
using WGneu.Models;
namespace WGneu.Windows {
public partial class MainWindow : Window {
private readonly WgContext _context = new WgContext();
private CollectionViewSource countryViewSource;
public MainWindow() {
InitializeComponent();
countryViewSource = (CollectionViewSource)FindResource("countryViewSource");
}
private void Window_Loaded(object sender, RoutedEventArgs e) {
_context.Countries.Load();
countryViewSource.Source = _context.Countries.Local.ToObservableCollection();
Button3.IsEnabled = App.IsPrintingReady;
Button4.IsEnabled = App.IsPrintingReady;
}
@ -45,20 +42,16 @@ namespace WGneu.Windows {
w.Show();
}
private void Button3_Click(object sender, EventArgs e) {
Documents.Template.Test();
}
private void Button4_Click(object sender, EventArgs e) {
Documents.Template.Generate(_context);
}
private void Button_Click(object sender, RoutedEventArgs e) {
}
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) {
Task.Run(async () => {
try {
using var letter = new BusinessLetter("Test Dokument", _context.Members.First());
await letter.Generate();
letter.Show();
} catch (Exception e) {
MessageBox.Show(e.ToString(), "PDF Generation", MessageBoxButton.OK, MessageBoxImage.Error);
}
});
}
}
}