Show error if output dir does not exist

This commit is contained in:
2026-03-03 09:43:47 +09:00
parent 3e91edb457
commit abc97eea2b
2 changed files with 18 additions and 4 deletions
+9
View File
@@ -63,6 +63,7 @@ class SettingsViewModel: ChangeNotifier
{ {
_settings.OutputPdfDir = value; _settings.OutputPdfDir = value;
NotifyPropertyChanged(); NotifyPropertyChanged();
NotifyPropertyChanged(nameof(IsOutputPdfDirValid));
} }
} }
@@ -122,6 +123,14 @@ class SettingsViewModel: ChangeNotifier
public void Save() public void Save()
{ {
if (!IsOutputPdfDirValid)
{
ErrorMessage = "Output directory cannot be found!";
}
else
{
ErrorMessage = "";
DialogHost.Close("DialogHost", _settings); DialogHost.Close("DialogHost", _settings);
} }
} }
}
+8 -3
View File
@@ -20,7 +20,7 @@
FontWeight="Bold" /> FontWeight="Bold" />
<TextBlock TextWrapping="Wrap" <TextBlock TextWrapping="Wrap"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Width="300"> Width="350">
Always reduce size of images if above this file size in megabytes (MB): Always reduce size of images if above this file size in megabytes (MB):
</TextBlock> </TextBlock>
<NumericUpDown Value="{Binding ImageResizeThreshold}" <NumericUpDown Value="{Binding ImageResizeThreshold}"
@@ -33,18 +33,23 @@
Margin="0,0,0,4" /> Margin="0,0,0,4" />
<CheckBox IsChecked="{Binding !UseDocnetPDFImageRendering}">Use legacy PDF handling (does not work with macOS annotations)</CheckBox> <CheckBox IsChecked="{Binding !UseDocnetPDFImageRendering}">Use legacy PDF handling (does not work with macOS annotations)</CheckBox>
<CheckBox IsChecked="{Binding SaveOutputPdfInWorkingDir}">Always save report PDF in working directory</CheckBox> <CheckBox IsChecked="{Binding SaveOutputPdfInWorkingDir}">Always save report PDF in working directory</CheckBox>
<Grid ColumnDefinitions="*, *" <Grid ColumnDefinitions="Auto, *"
IsVisible="{Binding !SaveOutputPdfInWorkingDir}"> IsVisible="{Binding !SaveOutputPdfInWorkingDir}">
<Button Content="Choose output folder..." <Button Content="Choose output folder..."
Grid.Column="0" Grid.Column="0"
Command="{Binding ChooseOutputFolder}" Command="{Binding ChooseOutputFolder}"
VerticalAlignment="Top"/> VerticalAlignment="Top"/>
<TextBlock Text="{Binding OutputPdfDirPath}" <TextBlock Text="{Binding OutputPdfDirPath}"
Margin="6,0,0,0" Margin="4,0,0,0"
TextWrapping="Wrap" TextWrapping="Wrap"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Top"/> VerticalAlignment="Top"/>
</Grid> </Grid>
<TextBlock TextWrapping="Wrap"
Foreground="Red"
Text="{Binding ErrorMessage}"
IsVisible="{Binding HasErrorMessage}"/>
<StackPanel Orientation="Horizontal" <StackPanel Orientation="Horizontal"
Spacing="12" Spacing="12"
Margin="0,4,0,0" Margin="0,4,0,0"