Can now make PDFs again; more UI tweaks
This commit is contained in:
@@ -34,14 +34,20 @@ class MainViewModel : BaseViewModel, IFontResolver
|
||||
_baseDir = Path.GetDirectoryName(Environment.ProcessPath) ?? "";
|
||||
_isCreatingPDF = false;
|
||||
_createPDFLog = "Ready to create PDF! Choose a folder to begin...";
|
||||
_reportFiles = new ObservableCollection<ReportFile>();
|
||||
_workingFolder = "";
|
||||
_reportFiles = new ObservableCollection<ReportFile>();
|
||||
_reportFiles.CollectionChanged += ( sender, e ) => { NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled)); };
|
||||
}
|
||||
|
||||
public bool IsCreatingPDF
|
||||
{
|
||||
get => _isCreatingPDF;
|
||||
set { _isCreatingPDF = value; NotifyPropertyChanged(); }
|
||||
set { _isCreatingPDF = value; NotifyPropertyChanged(); NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled)); }
|
||||
}
|
||||
|
||||
public bool IsCreatePDFButtonEnabled
|
||||
{
|
||||
get => !_isCreatingPDF && _reportFiles.Count > 0;
|
||||
}
|
||||
|
||||
public string CreatePDFLog
|
||||
@@ -121,10 +127,11 @@ class MainViewModel : BaseViewModel, IFontResolver
|
||||
var result = await DialogHost.Show(new EditFileViewModel(file, ViewModelChanger));
|
||||
}
|
||||
|
||||
private async void BuildPDF()
|
||||
public async void BuildPDF()
|
||||
{
|
||||
try
|
||||
{
|
||||
// TODO: use already found files
|
||||
await Task.Run(() => CreatePDF(_workingFolder));
|
||||
} catch (Exception e)
|
||||
{
|
||||
|
||||
+30
-19
@@ -10,7 +10,7 @@
|
||||
xmlns:progRing="clr-namespace:AvaloniaProgressRing;assembly=AvaloniaProgressRing"
|
||||
x:DataType="vm:MainViewModel">
|
||||
<Grid ColumnDefinitions="*"
|
||||
RowDefinitions="Auto, 2*, Auto, *">
|
||||
RowDefinitions="Auto, 2*, Auto, Auto, *">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Spacing="4">
|
||||
<Label Content="Easy Receipt Folder -> PDF Builder"
|
||||
@@ -21,21 +21,6 @@
|
||||
Command="{Binding ChooseFolder}"
|
||||
IsEnabled="{Binding !IsCreatingPDF}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Vertical"
|
||||
Spacing="2"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Margin="2">
|
||||
<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>
|
||||
<DataGrid x:Name="FilesGrid"
|
||||
Classes="DragAndDrop ItemsDragAndDrop"
|
||||
Grid.Row="1"
|
||||
@@ -108,10 +93,36 @@
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<GridSplitter Grid.Row="2"
|
||||
Background="LightGray"/>
|
||||
<StackPanel Orientation="Vertical"
|
||||
HorizontalAlignment="Center"
|
||||
Spacing="4"
|
||||
Grid.Row="2"
|
||||
Margin="4">
|
||||
<Button Content="Create Report PDF"
|
||||
Command="{Binding BuildPDF}"
|
||||
Classes="accent"
|
||||
IsEnabled="{Binding IsCreatePDFButtonEnabled}" />
|
||||
<StackPanel Orientation="Horizontal"
|
||||
IsVisible="{Binding IsCreatingPDF}"
|
||||
Spacing="6">
|
||||
<Label Content="Creating PDF..."
|
||||
IsVisible="{Binding IsCreatingPDF}"
|
||||
VerticalAlignment="Center"/>
|
||||
<progRing:ProgressRing Width="30"
|
||||
Height="30"
|
||||
IsActive="{Binding IsCreatingPDF}"
|
||||
Foreground="{DynamicResource SystemAccentColor}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Vertical"
|
||||
HorizontalAlignment="Stretch"
|
||||
Spacing="2"
|
||||
Grid.Row="3">
|
||||
<Rectangle Fill="Gray" Height="3" HorizontalAlignment="Stretch"/>
|
||||
<Label Content="Program Log" FontSize="14" FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
<ScrollViewer Margin="2"
|
||||
Grid.Row="3"
|
||||
Grid.Row="4"
|
||||
x:Name="LogScrollView">
|
||||
<SelectableTextBlock Text="{Binding CreatePDFLog}"
|
||||
Margin="2"
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<TextBlock TextAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
TextWrapping="Wrap"
|
||||
FontSize="16"
|
||||
MaxWidth="350">Are you sure you want to remove the item "<Run Text="{Binding File.Title}"/>"?</TextBlock>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
|
||||
Reference in New Issue
Block a user