Add report title box
This commit is contained in:
@@ -27,6 +27,7 @@ class MainViewModel : BaseViewModel, IFontResolver
|
|||||||
private string _createPDFLog;
|
private string _createPDFLog;
|
||||||
private string _workingFolder;
|
private string _workingFolder;
|
||||||
|
|
||||||
|
private string _reportTitle;
|
||||||
private ObservableCollection<ReportFile> _reportFiles;
|
private ObservableCollection<ReportFile> _reportFiles;
|
||||||
|
|
||||||
public MainViewModel(IChangeViewModel viewModelChanger) : base(viewModelChanger)
|
public MainViewModel(IChangeViewModel viewModelChanger) : base(viewModelChanger)
|
||||||
@@ -37,6 +38,18 @@ class MainViewModel : BaseViewModel, IFontResolver
|
|||||||
_workingFolder = "";
|
_workingFolder = "";
|
||||||
_reportFiles = new ObservableCollection<ReportFile>();
|
_reportFiles = new ObservableCollection<ReportFile>();
|
||||||
_reportFiles.CollectionChanged += ( sender, e ) => { NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled)); };
|
_reportFiles.CollectionChanged += ( sender, e ) => { NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled)); };
|
||||||
|
_reportTitle = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ReportTitle
|
||||||
|
{
|
||||||
|
get => _reportTitle;
|
||||||
|
set { _reportTitle = value; NotifyPropertyChanged(); NotifyPropertyChanged(nameof(IsTitleBoxVisible)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsTitleBoxVisible
|
||||||
|
{
|
||||||
|
get => !string.IsNullOrWhiteSpace(_workingFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsCreatingPDF
|
public bool IsCreatingPDF
|
||||||
@@ -86,6 +99,7 @@ class MainViewModel : BaseViewModel, IFontResolver
|
|||||||
if (Directory.Exists(folder.Path.LocalPath))
|
if (Directory.Exists(folder.Path.LocalPath))
|
||||||
{
|
{
|
||||||
_workingFolder = folder.Path.LocalPath;
|
_workingFolder = folder.Path.LocalPath;
|
||||||
|
NotifyPropertyChanged(nameof(IsTitleBoxVisible));
|
||||||
// TODO: Scan folder for saved info from previous reports and reload if needed
|
// TODO: Scan folder for saved info from previous reports and reload if needed
|
||||||
// Scan folder for files and display in DataGrid
|
// Scan folder for files and display in DataGrid
|
||||||
var filePaths = Directory.GetFiles(_workingFolder);
|
var filePaths = Directory.GetFiles(_workingFolder);
|
||||||
@@ -137,7 +151,7 @@ class MainViewModel : BaseViewModel, IFontResolver
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TODO: use already found files
|
// TODO: use already found files and information
|
||||||
await Task.Run(() => CreatePDF(_workingFolder));
|
await Task.Run(() => CreatePDF(_workingFolder));
|
||||||
} catch (Exception e)
|
} catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<Grid ColumnDefinitions="*"
|
<Grid ColumnDefinitions="*"
|
||||||
RowDefinitions="Auto, 2*, Auto, Auto, *">
|
RowDefinitions="Auto, 2*, Auto, Auto, *">
|
||||||
<StackPanel Orientation="Vertical"
|
<StackPanel Orientation="Vertical"
|
||||||
Spacing="4">
|
Spacing="2">
|
||||||
<Label Content="Easy Receipt Folder -> PDF Builder"
|
<Label Content="Easy Receipt Folder -> PDF Builder"
|
||||||
FontSize="20"
|
FontSize="20"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
@@ -20,6 +20,12 @@
|
|||||||
<Button Content="Choose Receipt Folder"
|
<Button Content="Choose Receipt Folder"
|
||||||
Command="{Binding ChooseFolder}"
|
Command="{Binding ChooseFolder}"
|
||||||
IsEnabled="{Binding !IsCreatingPDF}" />
|
IsEnabled="{Binding !IsCreatingPDF}" />
|
||||||
|
<Label Content="Report Title"
|
||||||
|
IsVisible="{Binding IsTitleBoxVisible}" />
|
||||||
|
<TextBox Text="{Binding ReportTitle}"
|
||||||
|
IsVisible="{Binding IsTitleBoxVisible}"
|
||||||
|
Watermark="Receipts December 2024"
|
||||||
|
Margin="2,0,2,4"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<DataGrid x:Name="FilesGrid"
|
<DataGrid x:Name="FilesGrid"
|
||||||
Classes="DragAndDrop ItemsDragAndDrop"
|
Classes="DragAndDrop ItemsDragAndDrop"
|
||||||
|
|||||||
Reference in New Issue
Block a user