Skip to content

Commit

Permalink
Fix auto save ui interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanfish committed Oct 9, 2023
1 parent f50837b commit 0d1ae59
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions NAPS2.Lib/ImportExport/AutoSaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,13 @@ private async Task<bool> InternalSave(AutoSaveSettings settings, List<ProcessedI
string subPath = placeholders.Substitute(settings.FilePath, true, i);
if (settings.PromptForFilePath)
{
if (_dialogHelper.PromptToSavePdfOrImage(subPath, out string? newPath))
Invoker.Current.Invoke(() =>
{
subPath = placeholders.Substitute(newPath!, true, i);
}
if (_dialogHelper.PromptToSavePdfOrImage(subPath, out string? newPath))
{
subPath = placeholders.Substitute(newPath!, true, i);
}
});
}
// TODO: This placeholder handling is complex and wrong in some cases (e.g. FilePerScan with ext = "jpg")
// TODO: Maybe have initial placeholders that replace date, then rely on the ops to increment the file num
Expand All @@ -139,7 +142,7 @@ private async Task<bool> InternalSave(AutoSaveSettings settings, List<ProcessedI
bool success = await op.Success;
if (success && doNotify)
{
_notify.PdfSaved(subPath);
Invoker.Current.Invoke(() => _notify.PdfSaved(subPath));
}
return (success, subPath);
}
Expand All @@ -153,7 +156,7 @@ private async Task<bool> InternalSave(AutoSaveSettings settings, List<ProcessedI
bool success = await op.Success;
if (success && doNotify && op.FirstFileSaved != null)
{
_notify.ImagesSaved(images.Count, op.FirstFileSaved);
Invoker.Current.Invoke(() => _notify.ImagesSaved(images.Count, op.FirstFileSaved));
}
return (success, subPath);
}
Expand Down

0 comments on commit 0d1ae59

Please sign in to comment.