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

@ -37,7 +37,7 @@ namespace Greenshot.Plugin {
FileSaved,
Error,
Info,
UploadedUrl
UploadedUri
}
public class SurfaceMessageEventArgs : EventArgs {

View file

@ -24,6 +24,75 @@ using System.Drawing;
using System.Windows.Forms;
namespace Greenshot.Plugin {
public class ExportInformation {
private string uri = null;
private string filepath = null;
private bool exportMade = false;
private string destinationDesignation = null;
private string destinationDescription = null;
private string errorMessage = null;
public ExportInformation(string destinationDesignation, string destinationDescription) {
this.destinationDesignation = destinationDesignation;
this.destinationDescription = destinationDescription;
}
public ExportInformation(string destinationDesignation, string destinationDescription, bool exportMade): this(destinationDesignation, destinationDescription) {
this.exportMade = exportMade;
}
public string DestinationDesignation {
get {
return destinationDesignation;
}
}
public string DestinationDescription {
get {
return destinationDescription;
}
set {
destinationDescription = value;
}
}
public bool ExportMade {
get {
return exportMade;
}
set {
exportMade = value;
}
}
public string Uri {
get {
return uri;
}
set {
uri = value;
}
}
public string ErrorMessage {
get {
return errorMessage;
}
set {
errorMessage = value;
}
}
public string Filepath {
get {
return filepath;
}
set {
filepath = value;
}
}
}
/// <summary>
/// Description of IDestination.
/// </summary>
@ -90,13 +159,20 @@ namespace Greenshot.Plugin {
get;
}
/// <summary>
/// Returns true if this destination returns a link
/// </summary>
bool isLinkable {
get;
}
/// <summary>
/// If a capture is made, and the destination is enabled, this method is called.
/// </summary>
/// <param name="manuallyInitiated">true if the user selected this destination from a GUI, false if it was called as part of a process</param>
/// <param name="surface"></param>
/// <param name="captureDetails"></param>
/// <returns>true if the destination has "exported" the capture</returns>
bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails);
/// <returns>DestinationExportInformation with information, like if the destination has "exported" the capture</returns>
ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails);
}
}

View file

@ -174,7 +174,29 @@ namespace Greenshot.Plugin {
IDictionary<PluginAttribute, IGreenshotPlugin> Plugins {
get;
}
/// <summary>
/// Get a destination by it's designation
/// </summary>
/// <param name="destination"></param>
/// <returns>IDestination</returns>
IDestination GetDestination(string designation);
/// <summary>
/// Get a list of all available destinations
/// </summary>
/// <returns>List<IDestination></returns>
List<IDestination> GetAllDestinations();
/// <summary>
/// Export a surface to the destination with has the supplied designation
/// </summary>
/// <param name="manuallyInitiated"></param>
/// <param name="designation"></param>
/// <param name="surface"></param>
/// <param name="captureDetails"></param>
ExportInformation ExportCapture(bool manuallyInitiated, string designation, ISurface surface, ICaptureDetails captureDetails);
/// <summary>
/// Make region capture with specified Handler
/// </summary>