From bfd90f9cd9a2f1cdaa4c4867a60ba77f965e66de Mon Sep 17 00:00:00 2001 From: Michael Babienco Date: Mon, 16 Feb 2026 14:29:26 +0900 Subject: [PATCH] Can now make PDFs again; more UI tweaks --- ViewModels/MainViewModel.cs | 13 ++++++-- Views/MainView.axaml | 57 +++++++++++++++++++++-------------- Views/WarningDeleteItem.axaml | 1 + 3 files changed, 45 insertions(+), 26 deletions(-) diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs index 6cb2e98..df1480c 100644 --- a/ViewModels/MainViewModel.cs +++ b/ViewModels/MainViewModel.cs @@ -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(); _workingFolder = ""; + _reportFiles = new ObservableCollection(); + _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) { diff --git a/Views/MainView.axaml b/Views/MainView.axaml index 8954ca0..15904c0 100644 --- a/Views/MainView.axaml +++ b/Views/MainView.axaml @@ -10,7 +10,7 @@ xmlns:progRing="clr-namespace:AvaloniaProgressRing;assembly=AvaloniaProgressRing" x:DataType="vm:MainViewModel"> + RowDefinitions="Auto, 2*, Auto, Auto, *"> - - - + +