diff --git a/Greenshot/Destinations/EmailDestination.cs b/Greenshot/Destinations/EmailDestination.cs
index 3beb89055..d5163ed49 100644
--- a/Greenshot/Destinations/EmailDestination.cs
+++ b/Greenshot/Destinations/EmailDestination.cs
@@ -218,14 +218,16 @@ namespace Greenshot.Destinations {
foreach (string inspectorCaption in inspectorCaptions.Keys) {
destinations.Add(new EmailDestination(inspectorCaption, inspectorCaptions[inspectorCaption]));
}
- PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
+ // Return the ExportInformation from the picker without processing, as this indirectly comes from us self
+ return PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
}
+ } else {
+ OutlookEmailExporter.ExportToOutlook(conf.OutlookEmailFormat, tmpFile, FilenameHelper.FillPattern(conf.EmailSubjectPattern, captureDetails, false), attachmentName, conf.EmailTo, conf.EmailCC, conf.EmailBCC);
+ exportInformation.ExportMade = true;
}
- OutlookEmailExporter.ExportToOutlook(conf.OutlookEmailFormat, tmpFile, FilenameHelper.FillPattern(conf.EmailSubjectPattern, captureDetails, false), attachmentName, conf.EmailTo, conf.EmailCC, conf.EmailBCC);
}
}
-
-
+ ProcessExport(exportInformation, surface);
return exportInformation;
}
}
diff --git a/Greenshot/Destinations/PickerDestination.cs b/Greenshot/Destinations/PickerDestination.cs
index 2511d4aaf..6881bad0c 100644
--- a/Greenshot/Destinations/PickerDestination.cs
+++ b/Greenshot/Destinations/PickerDestination.cs
@@ -67,7 +67,9 @@ namespace Greenshot.Destinations {
/// Details for the surface
/// The list of destinations to show
///
- public static void ShowPickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable destinations) {
+ public static ExportInformation ShowPickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable destinations) {
+ // Generate an empty ExportInformation object, for when nothing was selected.
+ ExportInformation exportInformation = new ExportInformation(DESIGNATION, Language.GetString(LangKey.settings_destination_picker));
ContextMenuStrip menu = new ContextMenuStrip();
menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) {
LOG.DebugFormat("Close reason: {0}", eventArgs.CloseReason);
@@ -102,7 +104,7 @@ namespace Greenshot.Destinations {
menu.Hide();
// Export
- ExportInformation exportInformation = clickedDestination.ExportCapture(true, surface, captureDetails);
+ exportInformation = clickedDestination.ExportCapture(true, surface, captureDetails);
if (exportInformation != null && exportInformation.ExportMade) {
LOG.InfoFormat("Export to {0} success, closing menu", exportInformation.DestinationDescription);
// close menu if the destination wasn't the editor
@@ -138,6 +140,7 @@ namespace Greenshot.Destinations {
menu.Items.Add(closeItem);
ShowMenuAtCursor(menu);
+ return exportInformation;
}
///
@@ -180,7 +183,6 @@ namespace Greenshot.Destinations {
/// Details of the capture
/// true if export was made
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
- ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
List destinations = new List();
foreach(IDestination destination in DestinationHelper.GetAllDestinations()) {
if ("Picker".Equals(destination.Designation)) {
@@ -192,10 +194,8 @@ namespace Greenshot.Destinations {
destinations.Add(destination);
}
- ShowPickerMenu(true, surface, captureDetails, destinations);
- exportInformation.ExportMade = true;
- // No Processing! :)
- return exportInformation;
+ // No Processing, this is done in the selected destination (if anything was selected)
+ return ShowPickerMenu(true, surface, captureDetails, destinations);
}
}
}
diff --git a/Greenshot/Destinations/PowerpointDestination.cs b/Greenshot/Destinations/PowerpointDestination.cs
index 9cf99c688..f25c0a2d0 100644
--- a/Greenshot/Destinations/PowerpointDestination.cs
+++ b/Greenshot/Destinations/PowerpointDestination.cs
@@ -133,11 +133,10 @@ namespace Greenshot.Destinations {
foreach (string presentation in presentations) {
destinations.Add(new PowerpointDestination(presentation));
}
- PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
- exportInformation.ExportMade = true;
+ // Return the ExportInformation from the picker without processing, as this indirectly comes from us self
+ return PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
}
- }
- if (!exportInformation.ExportMade) {
+ } else if (!exportInformation.ExportMade) {
PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title);
exportInformation.ExportMade = true;
}
diff --git a/Greenshot/Destinations/WordDestination.cs b/Greenshot/Destinations/WordDestination.cs
index 2f11c3b1a..87db60566 100644
--- a/Greenshot/Destinations/WordDestination.cs
+++ b/Greenshot/Destinations/WordDestination.cs
@@ -142,13 +142,15 @@ namespace Greenshot.Destinations {
foreach (string document in documents) {
destinations.Add(new WordDestination(document));
}
- PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
+ // Return the ExportInformation from the picker without processing, as this indirectly comes from us self
+ return PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
}
}
try {
WordExporter.InsertIntoNewDocument(tmpFile);
exportInformation.ExportMade = true;
} catch(Exception) {
+ // Retry once, just in case
try {
WordExporter.InsertIntoNewDocument(tmpFile);
exportInformation.ExportMade = true;