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) ?? "";
|
_baseDir = Path.GetDirectoryName(Environment.ProcessPath) ?? "";
|
||||||
_isCreatingPDF = false;
|
_isCreatingPDF = false;
|
||||||
_createPDFLog = "Ready to create PDF! Choose a folder to begin...";
|
_createPDFLog = "Ready to create PDF! Choose a folder to begin...";
|
||||||
_reportFiles = new ObservableCollection<ReportFile>();
|
|
||||||
_workingFolder = "";
|
_workingFolder = "";
|
||||||
|
_reportFiles = new ObservableCollection<ReportFile>();
|
||||||
|
_reportFiles.CollectionChanged += ( sender, e ) => { NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled)); };
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsCreatingPDF
|
public bool IsCreatingPDF
|
||||||
{
|
{
|
||||||
get => _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
|
public string CreatePDFLog
|
||||||
@@ -121,10 +127,11 @@ class MainViewModel : BaseViewModel, IFontResolver
|
|||||||
var result = await DialogHost.Show(new EditFileViewModel(file, ViewModelChanger));
|
var result = await DialogHost.Show(new EditFileViewModel(file, ViewModelChanger));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void BuildPDF()
|
public async void BuildPDF()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// TODO: use already found files
|
||||||
await Task.Run(() => CreatePDF(_workingFolder));
|
await Task.Run(() => CreatePDF(_workingFolder));
|
||||||
} catch (Exception e)
|
} catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
+34
-23
@@ -10,7 +10,7 @@
|
|||||||
xmlns:progRing="clr-namespace:AvaloniaProgressRing;assembly=AvaloniaProgressRing"
|
xmlns:progRing="clr-namespace:AvaloniaProgressRing;assembly=AvaloniaProgressRing"
|
||||||
x:DataType="vm:MainViewModel">
|
x:DataType="vm:MainViewModel">
|
||||||
<Grid ColumnDefinitions="*"
|
<Grid ColumnDefinitions="*"
|
||||||
RowDefinitions="Auto, 2*, Auto, *">
|
RowDefinitions="Auto, 2*, Auto, Auto, *">
|
||||||
<StackPanel Orientation="Vertical"
|
<StackPanel Orientation="Vertical"
|
||||||
Spacing="4">
|
Spacing="4">
|
||||||
<Label Content="Easy Receipt Folder -> PDF Builder"
|
<Label Content="Easy Receipt Folder -> PDF Builder"
|
||||||
@@ -21,21 +21,6 @@
|
|||||||
Command="{Binding ChooseFolder}"
|
Command="{Binding ChooseFolder}"
|
||||||
IsEnabled="{Binding !IsCreatingPDF}" />
|
IsEnabled="{Binding !IsCreatingPDF}" />
|
||||||
</StackPanel>
|
</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"
|
<DataGrid x:Name="FilesGrid"
|
||||||
Classes="DragAndDrop ItemsDragAndDrop"
|
Classes="DragAndDrop ItemsDragAndDrop"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
@@ -108,15 +93,41 @@
|
|||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<GridSplitter Grid.Row="2"
|
<StackPanel Orientation="Vertical"
|
||||||
Background="LightGray"/>
|
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"
|
<ScrollViewer Margin="2"
|
||||||
Grid.Row="3"
|
Grid.Row="4"
|
||||||
x:Name="LogScrollView">
|
x:Name="LogScrollView">
|
||||||
<SelectableTextBlock Text="{Binding CreatePDFLog}"
|
<SelectableTextBlock Text="{Binding CreatePDFLog}"
|
||||||
Margin="2"
|
Margin="2"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
x:Name="LogBlock"/>
|
x:Name="LogBlock"/>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<TextBlock TextAlignment="Center"
|
<TextBlock TextAlignment="Center"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
|
FontSize="16"
|
||||||
MaxWidth="350">Are you sure you want to remove the item "<Run Text="{Binding File.Title}"/>"?</TextBlock>
|
MaxWidth="350">Are you sure you want to remove the item "<Run Text="{Binding File.Title}"/>"?</TextBlock>
|
||||||
<StackPanel Orientation="Horizontal"
|
<StackPanel Orientation="Horizontal"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
|
|||||||
Reference in New Issue
Block a user