Cleanup
This commit is contained in:
@ -7,18 +7,8 @@
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800" ResizeMode="CanResize" SizeToContent="Manual"
|
||||
Loaded="Window_Loaded">
|
||||
<Window.Resources>
|
||||
<CollectionViewSource x:Key="countryViewSource"/>
|
||||
<DataTemplate x:Key="asdf">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<ComboBox HorizontalAlignment="Left" Margin="175,149,0,0" VerticalAlignment="Top" Width="120" ItemsSource="{Binding Source={StaticResource countryViewSource}}" ItemTemplate="{StaticResource asdf}" SelectionChanged="ComboBox_SelectionChanged" IsEditable="True"/>
|
||||
<Button x:Name="Button2" Content="Mitglieder" Margin="472,182,178,0" VerticalAlignment="Top" Click="Button2_Click"/>
|
||||
<Button x:Name="Button3" Content="Print" Margin="425,255,225,0" VerticalAlignment="Top" Click="Button3_Click" Tag="Print"/>
|
||||
<Button x:Name="Button4" Content="Generate" Margin="425,300,225,0" VerticalAlignment="Top" Click="Button4_Click" Tag="Print"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -287,8 +287,9 @@
|
||||
<RadioButton x:Name="ContactEmailInput" GroupName="DefaultContact" Content="E-Mail" IsEnabled="False"
|
||||
Checked="RadioButton_Changed" Unchecked="RadioButton_Changed"
|
||||
HorizontalAlignment="Left" Margin="60,225,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.ColumnSpan="2"/>
|
||||
|
||||
<Button x:Name="AreaCommitmentButton" Content="Flächenbindungen" Click="AreaCommitmentButton_Click"
|
||||
HorizontalAlignment="Left" Margin="10,245,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
|
||||
HorizontalAlignment="Right" Margin="10,10,10,10" VerticalAlignment="Bottom" Grid.ColumnSpan="3"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
Reference in New Issue
Block a user