diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs index 65ea6ce..083b9dd 100644 --- a/ViewModels/MainViewModel.cs +++ b/ViewModels/MainViewModel.cs @@ -75,7 +75,13 @@ class MainViewModel : BaseViewModel, IFontResolver public bool IsCreatingPDF { get => _isCreatingPDF; - set { _isCreatingPDF = value; NotifyPropertyChanged(); NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled)); } + set + { + _isCreatingPDF = value; + NotifyPropertyChanged(); + NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled)); + NotifyPropertyChanged(nameof(HasWorkingFolderAndNotMakingPDF)); + } } public bool IsCreatePDFButtonEnabled @@ -83,6 +89,28 @@ class MainViewModel : BaseViewModel, IFontResolver get => !_isCreatingPDF && _reportFiles.Count > 0; } + public bool HasWorkingFolder + { + get => !string.IsNullOrWhiteSpace(_workingFolder) && Directory.Exists(_workingFolder); + } + + public bool HasWorkingFolderAndNotMakingPDF + { + get => !string.IsNullOrWhiteSpace(_workingFolder) && Directory.Exists(_workingFolder) && !_isCreatingPDF; + } + + public string WorkingFolder + { + get => _workingFolder; + set + { + _workingFolder = value; + NotifyPropertyChanged(); + NotifyPropertyChanged(nameof(HasWorkingFolder)); + NotifyPropertyChanged(nameof(HasWorkingFolderAndNotMakingPDF)); + } + } + public string CreatePDFLog { get => _createPDFLog; @@ -137,7 +165,7 @@ class MainViewModel : BaseViewModel, IFontResolver { if (Directory.Exists(path)) { - _workingFolder = path; + WorkingFolder = path; NotifyPropertyChanged(nameof(IsTitleBoxVisible)); var reportFilePath = Path.Combine(path, GetReportSavedDataFileName()); var successfullyLoadedPriorReport = false; @@ -151,7 +179,7 @@ class MainViewModel : BaseViewModel, IFontResolver { ReportFiles = new ObservableCollection(report.Files); ReportTitle = report.Title; - _workingFolder = report.BaseFolder; + WorkingFolder = report.BaseFolder; _lastGeneratedTime = report.LastGenerated ?? null; LogInfo("Reloaded report last saved at {0}", report.LastSaved); successfullyLoadedPriorReport = true; diff --git a/Views/MainView.axaml b/Views/MainView.axaml index 3d74736..5102ad4 100644 --- a/Views/MainView.axaml +++ b/Views/MainView.axaml @@ -25,9 +25,19 @@ FontSize="20" FontWeight="Bold" HorizontalAlignment="Center"/> -