PromptToSaveImage() public method

public PromptToSaveImage ( string defaultPath, string &savePath ) : bool
defaultPath string
savePath string
return bool
 private void BtnChooseFolder_Click(object sender, EventArgs e)
 {
     if (dialogHelper.PromptToSaveImage(txtDefaultFilePath.Text, out string savePath))
     {
         txtDefaultFilePath.Text = savePath;
     }
 }
Example #2
0
        public bool SaveImages(List <ScannedImage> images)
        {
            if (images.Any())
            {
                string savePath;

                var imageSettings = imageSettingsContainer.ImageSettings;
                if (imageSettings.SkipSavePrompt && Path.IsPathRooted(imageSettings.DefaultFileName))
                {
                    savePath = imageSettings.DefaultFileName;
                }
                else
                {
                    if (!dialogHelper.PromptToSaveImage(imageSettings.DefaultFileName, out savePath))
                    {
                        return(false);
                    }
                }

                var op           = operationFactory.Create <SaveImagesOperation>();
                var progressForm = formFactory.Create <FProgress>();
                progressForm.Operation = op;
                progressForm.Start     = () => op.Start(savePath, DateTime.Now, images);
                progressForm.ShowDialog();
                if (op.Status.Success)
                {
                    changeTracker.HasUnsavedChanges = false;
                    notify.ImagesSaved(images.Count, op.FirstFileSaved);
                    return(true);
                }
            }
            return(false);
        }
Example #3
0
        public async Task <bool> SaveImages(List <ScannedImage> images, ISaveNotify notify)
        {
            if (images.Any())
            {
                string savePath;

                var imageSettings = imageSettingsContainer.ImageSettings;
                if (imageSettings.SkipSavePrompt && Path.IsPathRooted(imageSettings.DefaultFileName))
                {
                    savePath = imageSettings.DefaultFileName;
                }
                else
                {
                    if (!dialogHelper.PromptToSaveImage(imageSettings.DefaultFileName, out savePath))
                    {
                        return(false);
                    }
                }

                var op          = operationFactory.Create <SaveImagesOperation>();
                var changeToken = changeTracker.State;
                if (op.Start(savePath, DateTime.Now, images))
                {
                    operationProgress.ShowProgress(op);
                }
                if (await op.Success)
                {
                    changeTracker.Saved(changeToken);
                    notify?.ImagesSaved(images.Count, op.FirstFileSaved);
                    return(true);
                }
            }
            return(false);
        }