From 0f6d37417068eb54e5ea160d41fc8d9601b23397 Mon Sep 17 00:00:00 2001 From: Krzysztof Date: Thu, 4 Feb 2021 16:19:18 +0100 Subject: [PATCH] #268 coded - proposition --- Greenshot/Destinations/ClipboardDestination.cs | 2 ++ Greenshot/Forms/ImageEditorForm.cs | 8 +++++++- GreenshotPlugin/Interfaces/IDestination.cs | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Greenshot/Destinations/ClipboardDestination.cs b/Greenshot/Destinations/ClipboardDestination.cs index 9cfb0aec5..d9ab1c6a7 100644 --- a/Greenshot/Destinations/ClipboardDestination.cs +++ b/Greenshot/Destinations/ClipboardDestination.cs @@ -64,6 +64,8 @@ namespace Greenshot.Destinations { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(Designation, Description); + // close the form after copying the image to clipboard + exportInformation.CloseForm = true; try { ClipboardHelper.SetClipboardData(surface); exportInformation.ExportMade = true; diff --git a/Greenshot/Forms/ImageEditorForm.cs b/Greenshot/Forms/ImageEditorForm.cs index 6e19df179..e1991a294 100644 --- a/Greenshot/Forms/ImageEditorForm.cs +++ b/Greenshot/Forms/ImageEditorForm.cs @@ -932,7 +932,11 @@ namespace Greenshot { } if (destination.EditorShortcutKeys == keys) { - destination.ExportCapture(true, _surface, _surface.CaptureDetails); + ExportInformation exportInformation = destination.ExportCapture(true, _surface, _surface.CaptureDetails); + if (exportInformation != null && exportInformation.ExportMade) { + if (exportInformation.CloseForm) + this.Close(); + } return true; } } @@ -1273,6 +1277,8 @@ namespace Greenshot { ExportInformation exportInformation = clickedDestination?.ExportCapture(true, _surface, _surface.CaptureDetails); if (exportInformation != null && exportInformation.ExportMade) { _surface.Modified = false; + if (exportInformation.CloseForm) + this.Close(); } } diff --git a/GreenshotPlugin/Interfaces/IDestination.cs b/GreenshotPlugin/Interfaces/IDestination.cs index e4f39d796..0b5b5c7ce 100644 --- a/GreenshotPlugin/Interfaces/IDestination.cs +++ b/GreenshotPlugin/Interfaces/IDestination.cs @@ -48,6 +48,11 @@ namespace GreenshotPlugin.Interfaces { public string ErrorMessage { get; set; } public string Filepath { get; set; } + + /// + /// Set to true to close the invoking form. + /// + public bool CloseForm { get; set; } } ///