PromptToSavePdf() public method

public PromptToSavePdf ( string defaultPath, string &savePath ) : bool
defaultPath string
savePath string
return bool
コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: FPdfSettings.cs プロジェクト: yogvirus/naps2
 private void btnChooseFolder_Click(object sender, EventArgs e)
 {
     if (dialogHelper.PromptToSavePdf(txtDefaultFilePath.Text, out string savePath))
     {
         txtDefaultFilePath.Text = savePath;
     }
 }