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 public bool IsCreatingPDF
{ {
get => _isCreatingPDF; get => _isCreatingPDF;
set { _isCreatingPDF = value; NotifyPropertyChanged(); NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled)); } set
{
_isCreatingPDF = value;
NotifyPropertyChanged();
NotifyPropertyChanged(nameof(IsCreatePDFButtonEnabled));
NotifyPropertyChanged(nameof(HasWorkingFolderAndNotMakingPDF));
}
} }
public bool IsCreatePDFButtonEnabled public bool IsCreatePDFButtonEnabled
@@ -83,6 +89,28 @@ class MainViewModel : BaseViewModel, IFontResolver
get => !_isCreatingPDF && _reportFiles.Count > 0; 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 public string CreatePDFLog
{ {
get => _createPDFLog; get => _createPDFLog;
@@ -137,7 +165,7 @@ class MainViewModel : BaseViewModel, IFontResolver
{ {
if (Directory.Exists(path)) if (Directory.Exists(path))
{ {
_workingFolder = path; WorkingFolder = path;
NotifyPropertyChanged(nameof(IsTitleBoxVisible)); NotifyPropertyChanged(nameof(IsTitleBoxVisible));
var reportFilePath = Path.Combine(path, GetReportSavedDataFileName()); var reportFilePath = Path.Combine(path, GetReportSavedDataFileName());
var successfullyLoadedPriorReport = false; var successfullyLoadedPriorReport = false;
@@ -151,7 +179,7 @@ class MainViewModel : BaseViewModel, IFontResolver
{ {
ReportFiles = new ObservableCollection<ReportFile>(report.Files); ReportFiles = new ObservableCollection<ReportFile>(report.Files);
ReportTitle = report.Title; ReportTitle = report.Title;
_workingFolder = report.BaseFolder; WorkingFolder = report.BaseFolder;
_lastGeneratedTime = report.LastGenerated ?? null; _lastGeneratedTime = report.LastGenerated ?? null;
LogInfo("Reloaded report last saved at {0}", report.LastSaved); LogInfo("Reloaded report last saved at {0}", report.LastSaved);
successfullyLoadedPriorReport = true; successfullyLoadedPriorReport = true;
+12 -2
View File
@@ -25,9 +25,19 @@
FontSize="20" FontSize="20"
FontWeight="Bold" FontWeight="Bold"
HorizontalAlignment="Center"/> HorizontalAlignment="Center"/>
<Grid ColumnDefinitions="Auto, *"
Margin="4,0,0,0">
<Button Content="Choose Receipt Folder" <Button Content="Choose Receipt Folder"
Command="{Binding ChooseFolder}" 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" <Label Content="Report Title"
IsVisible="{Binding IsTitleBoxVisible}" /> IsVisible="{Binding IsTitleBoxVisible}" />
<TextBox Text="{Binding ReportTitle}" <TextBox Text="{Binding ReportTitle}"
@@ -198,7 +208,7 @@
<TextBlock><Run Text="&#x002b;" FontFamily="{StaticResource FontAwesomeSolid}"/> Add Item</TextBlock> <TextBlock><Run Text="&#x002b;" FontFamily="{StaticResource FontAwesomeSolid}"/> Add Item</TextBlock>
</Button> </Button>
<Button Command="{Binding SaveInterimReportInfo}" <Button Command="{Binding SaveInterimReportInfo}"
IsEnabled="{Binding IsCreatePDFButtonEnabled}"> IsEnabled="{Binding HasWorkingFolderAndNotMakingPDF}">
<TextBlock><Run Text="&#xf0c7;" FontFamily="{StaticResource FontAwesomeSolid}"/> Save Report Info</TextBlock> <TextBlock><Run Text="&#xf0c7;" FontFamily="{StaticResource FontAwesomeSolid}"/> Save Report Info</TextBlock>
</Button> </Button>
<Button Command="{Binding ResortPDFItemsByDate}" <Button Command="{Binding ResortPDFItemsByDate}"