Show working folder

This commit is contained in:
2026-02-17 16:38:42 +09:00
parent 08f0db97c1
commit 2531beab05
2 changed files with 45 additions and 7 deletions
+31 -3
View File
@@ -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<ReportFile>(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;
+12 -2
View File
@@ -25,9 +25,19 @@
FontSize="20"
FontWeight="Bold"
HorizontalAlignment="Center"/>
<Grid ColumnDefinitions="Auto, *"
Margin="4,0,0,0">
<Button Content="Choose Receipt Folder"
Command="{Binding ChooseFolder}"
IsEnabled="{Binding !IsCreatingPDF}" />
IsEnabled="{Binding !IsCreatingPDF}"
Grid.Column="0" />
<TextBlock Text="{Binding WorkingFolder}"
VerticalAlignment="Center"
TextWrapping="NoWrap"
Margin="4,0,4,0"
TextTrimming="PrefixCharacterEllipsis"
Grid.Column="1"/>
</Grid>
<Label Content="Report Title"
IsVisible="{Binding IsTitleBoxVisible}" />
<TextBox Text="{Binding ReportTitle}"
@@ -198,7 +208,7 @@
<TextBlock><Run Text="&#x002b;" FontFamily="{StaticResource FontAwesomeSolid}"/> Add Item</TextBlock>
</Button>
<Button Command="{Binding SaveInterimReportInfo}"
IsEnabled="{Binding IsCreatePDFButtonEnabled}">
IsEnabled="{Binding HasWorkingFolderAndNotMakingPDF}">
<TextBlock><Run Text="&#xf0c7;" FontFamily="{StaticResource FontAwesomeSolid}"/> Save Report Info</TextBlock>
</Button>
<Button Command="{Binding ResortPDFItemsByDate}"