Run PDF creation async and show log/progress
This commit is contained in:
+36
-5
@@ -5,10 +5,41 @@
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="ReceiptPDFBuilder.Views.MainView"
|
||||
xmlns:vm="clr-namespace:ReceiptPDFBuilder.ViewModels"
|
||||
xmlns:progRing="clr-namespace:AvaloniaProgressRing;assembly=AvaloniaProgressRing"
|
||||
x:DataType="vm:MainViewModel">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Spacing="2">
|
||||
<Button Content="Choose Folder"
|
||||
Command="{Binding ChooseFolder}" />
|
||||
</StackPanel>
|
||||
<Grid ColumnDefinitions="Auto, *"
|
||||
RowDefinitions="Auto, *">
|
||||
<Label Content="Easy Receipt Folder -> PDF Builder"
|
||||
Grid.Row="0"
|
||||
Grid.ColumnSpan="2"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"/>
|
||||
<StackPanel Orientation="Vertical"
|
||||
Spacing="2"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Margin="2">
|
||||
<Button Content="Choose Receipt Folder"
|
||||
Command="{Binding ChooseFolder}"
|
||||
IsEnabled="{Binding !IsCreatingPDF}" />
|
||||
<Label Content="Creating PDF..."
|
||||
IsVisible="{Binding IsCreatingPDF}"/>
|
||||
<progRing:ProgressRing Width="80"
|
||||
Height="80"
|
||||
IsActive="{Binding IsCreatingPDF}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="LightBlue"
|
||||
Margin="10,20,0,0"/>
|
||||
</StackPanel>
|
||||
<ScrollViewer Grid.Column="1"
|
||||
Margin="2"
|
||||
Grid.Row="1"
|
||||
x:Name="LogScrollView">
|
||||
<SelectableTextBlock Text="{Binding CreatePDFLog}"
|
||||
Margin="2"
|
||||
TextWrapping="Wrap"
|
||||
x:Name="LogBlock"/>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -9,6 +9,12 @@ namespace ReceiptPDFBuilder.Views
|
||||
public MainView()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
LogBlock.PropertyChanged += LogBlock_PropertyChanged;
|
||||
}
|
||||
|
||||
private void LogBlock_PropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
|
||||
{
|
||||
LogScrollView.ScrollToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user