diff --git a/Greenshot/Destinations/EditorDestination.cs b/Greenshot/Destinations/EditorDestination.cs index 6851e8076..a069343f8 100644 --- a/Greenshot/Destinations/EditorDestination.cs +++ b/Greenshot/Destinations/EditorDestination.cs @@ -110,10 +110,15 @@ namespace Greenshot.Destinations { LOG.Error(e); } } else { - using (Bitmap image = (Bitmap)surface.GetImageForExport()) { - editor.Surface.AddBitmapContainer(image, 10, 10); - } - surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description)); + try { + using (Bitmap image = (Bitmap)surface.GetImageForExport()) { + editor.Surface.AddBitmapContainer(image, 10, 10); + } + surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description)); + return true; + } catch (Exception e) { + LOG.Error(e); + } } return false; } diff --git a/Greenshot/Destinations/PickerDestination.cs b/Greenshot/Destinations/PickerDestination.cs index 1919959e4..c125a7985 100644 --- a/Greenshot/Destinations/PickerDestination.cs +++ b/Greenshot/Destinations/PickerDestination.cs @@ -78,15 +78,26 @@ namespace Greenshot.Destinations { if (clickedDestination == null) { return; } - // Make sure the menu is closed - menu.Close(); + bool isEditor = EditorDestination.DESIGNATION.Equals(clickedDestination.Designation); + // Make sure the menu is invisible, don't close it + menu.Hide(); + + // Export bool result = clickedDestination.ExportCapture(true, surface, captureDetails); - // TODO: Find some better way to detect that we exported to the editor - if (!EditorDestination.DESIGNATION.Equals(clickedDestination.Designation) || result == false) { - LOG.DebugFormat("Disposing as Destination was {0} and result {1}", clickedDestination.Description, result); - // Cleanup surface - surface.Dispose(); - } + LOG.InfoFormat("Destination was {0} and result {1}", clickedDestination.Designation, result); + if (result == true) { + LOG.Info("Export success, closing menu"); + // close menu if the destination wasn't the editor + menu.Close(); + + // Cleanup surface, only if the destination wasn't the editor + if (!isEditor) { + surface.Dispose(); + } + } else { + LOG.Info("Export failed, showing menu again"); + menu.Show(); + } } ); if (item != null) {