public async Task <bool> SavePDF(List <ScannedImage> images, ISaveNotify notify) { if (images.Any()) { string savePath; var pdfSettings = pdfSettingsContainer.PdfSettings; if (pdfSettings.SkipSavePrompt && Path.IsPathRooted(pdfSettings.DefaultFileName)) { savePath = pdfSettings.DefaultFileName; } else { if (!dialogHelper.PromptToSavePdf(pdfSettings.DefaultFileName, out savePath)) { return(false); } } var subSavePath = fileNamePlaceholders.SubstitutePlaceholders(savePath, DateTime.Now); var changeToken = changeTracker.State; if (await ExportPDF(subSavePath, images, false, null)) { changeTracker.Saved(changeToken); notify?.PdfSaved(subSavePath); return(true); } } return(false); }
public async Task <bool> SavePdf(List <ScannedImage> images, ISaveNotify notify) { if (!images.Any()) { return(false); } string savePath; var pdfSettings = pdfSettingsContainer.PdfSettings; if (pdfSettings.SkipSavePrompt && Path.IsPathRooted(pdfSettings.DefaultFileName)) { savePath = pdfSettings.DefaultFileName; } else { if (!dialogHelper.PromptToSavePdf(pdfSettings.DefaultFileName, out savePath)) { return(false); } } var changeToken = changeTracker.State; var firstFileSaved = await ExportPdf(savePath, images, false, null); if (firstFileSaved == null) { return(false); } changeTracker.Saved(changeToken); notify?.PdfSaved(firstFileSaved); return(true); }
public bool SavePDF(List <ScannedImage> images) { if (images.Any()) { string savePath; var pdfSettings = pdfSettingsContainer.PdfSettings; if (pdfSettings.SkipSavePrompt && Path.IsPathRooted(pdfSettings.DefaultFileName)) { savePath = pdfSettings.DefaultFileName; } else { if (!dialogHelper.PromptToSavePdf(pdfSettings.DefaultFileName, out savePath)) { return(false); } } var subSavePath = fileNamePlaceholders.SubstitutePlaceholders(savePath, DateTime.Now); if (ExportPDF(subSavePath, images, false)) { changeTracker.HasUnsavedChanges = false; notify.PdfSaved(subSavePath); return(true); } } return(false); }
private void btnChooseFolder_Click(object sender, EventArgs e) { if (dialogHelper.PromptToSavePdf(txtDefaultFilePath.Text, out string savePath)) { txtDefaultFilePath.Text = savePath; } }