Extended the ExportCapture with ExportInformation as a result object, this allows us to better and more consistently return & handle information from the export. Also it should be easier to extend the functionality. TODO: Still need to cleanup some messages, some are no longer needed

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2034 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-09-14 15:04:37 +00:00
commit be797ecf8a
27 changed files with 379 additions and 172 deletions

View file

@ -90,7 +90,8 @@ namespace Greenshot.Destinations {
}
}
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
if (editor == null) {
// Make sure we collect the garbage before opening the screenshot
GC.Collect();
@ -105,22 +106,24 @@ namespace Greenshot.Destinations {
editorForm.Show();
editorForm.Activate();
LOG.Debug("Finished opening Editor");
return true;
exportInformation.ExportMade = true;
} catch (Exception e) {
LOG.Error(e);
exportInformation.ErrorMessage = e.Message;
}
} else {
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;
exportInformation.ExportMade = true;
} catch (Exception e) {
LOG.Error(e);
}
exportInformation.ErrorMessage = e.Message;
}
}
return false;
ProcessExport(exportInformation, surface);
return exportInformation;
}
}
}