Documentation fixes, reducing the warnings to < 1000

This commit is contained in:
Robin 2019-04-30 11:34:08 +02:00
commit 1aed58ba98
No known key found for this signature in database
GPG key ID: CBBB6557491B1140
162 changed files with 2190 additions and 618 deletions

View file

@ -32,6 +32,7 @@ namespace Greenshot.Addon.Box
/// <inheritdoc />
public class BoxAddonModule : AddonModule
{
/// <inheritdoc />
protected override void Load(ContainerBuilder builder)
{
builder

View file

@ -44,6 +44,9 @@ using Greenshot.Gfx;
namespace Greenshot.Addon.Box
{
/// <summary>
/// This is the destination for the Box service
/// </summary>
[Destination("Box")]
public class BoxDestination : AbstractDestination
{
@ -58,7 +61,18 @@ namespace Greenshot.Addon.Box
private static readonly Uri UploadFileUri = new Uri("https://upload.box.com/api/2.0/files/content");
private static readonly Uri FilesUri = new Uri("https://www.box.com/api/2.0/files/");
public BoxDestination(
/// <summary>
/// DI constructor
/// </summary>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="exportNotification">ExportNotification</param>
/// <param name="boxConfiguration">IBoxConfiguration</param>
/// <param name="boxLanguage">IBoxLanguage</param>
/// <param name="pleaseWaitFormFactory">Func factory for PleaseWaitForm</param>
/// <param name="httpConfiguration">IHttpConfiguration</param>
/// <param name="resourceProvider">IResourceProvider</param>
public BoxDestination(
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage,
ExportNotification exportNotification,
@ -96,9 +110,11 @@ namespace Greenshot.Addon.Box
};
}
public override string Description => _boxLanguage.UploadMenuItem;
/// <inheritdoc />
public override string Description => _boxLanguage.UploadMenuItem;
public override IBitmapWithNativeSupport DisplayIcon
/// <inheritdoc />
public override IBitmapWithNativeSupport DisplayIcon
{
get
{
@ -110,7 +126,8 @@ namespace Greenshot.Addon.Box
}
}
public override async Task<ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
/// <inheritdoc />
public override async Task<ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
{
var exportInformation = new ExportInformation(Designation, Description);
var uploadUrl = await UploadAsync(surface).ConfigureAwait(true);

View file

@ -24,6 +24,7 @@ namespace Greenshot.Addon.Box.Configuration
[Language("Box")]
public interface IBoxLanguage : ILanguage
{
#pragma warning disable 1591
string CommunicationWait { get; }
string Configure { get; }

View file

@ -27,6 +27,7 @@ namespace Greenshot.Addon.Box.Configuration.Impl
{
internal class BoxConfigurationImpl : IniSectionBase<IBoxConfiguration>, IBoxConfiguration
{
#pragma warning disable 1591
public string OutputFilePath { get; set; }
public bool OutputFileAllowOverwrite { get; set; }
public string OutputFileFilenamePattern { get; set; }

View file

@ -27,8 +27,9 @@ namespace Greenshot.Addon.Box.Configuration.Impl
/// </summary>
[SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")]
#pragma warning disable CS1591
public class BoxLanguageImpl : LanguageBase<IBoxLanguage>, IBoxLanguage
internal class BoxLanguageImpl : LanguageBase<IBoxLanguage>, IBoxLanguage
{
#pragma warning disable 1591
public string CommunicationWait { get; }
public string Configure { get; }
public string LabelAfterUpload { get; }

View file

@ -24,13 +24,14 @@ using Greenshot.Core.Enums;
namespace Greenshot.Addon.Confluence.Configuration
{
/// <summary>
/// Description of ConfluenceConfiguration.
/// The configuration for the confluence add-on
/// </summary>
[IniSection("Confluence")]
[Description("Greenshot Confluence Plugin configuration")]
public interface IConfluenceConfiguration : IIniSection
{
[Description("Url to Confluence system, including wsdl.")]
#pragma warning disable 1591
[Description("Url to Confluence system, including wsdl.")]
[DefaultValue("https://confluence")]
string Url { get; set; }

View file

@ -21,9 +21,13 @@ using Dapplo.Config.Language;
namespace Greenshot.Addon.Confluence.Configuration
{
/// <summary>
/// The translations for the Confluence add-on
/// </summary>
[Language("Confluence")]
public interface IConfluenceLanguage : ILanguage
{
#pragma warning disable 1591
string PluginSettings { get; }
string LoginError { get; }
string LabelUrl { get; }

View file

@ -24,6 +24,7 @@ namespace Greenshot.Addon.Confluence.Configuration.Impl
{
internal class ConfluenceConfigurationImpl : IniSectionBase<IConfluenceConfiguration>, IConfluenceConfiguration
{
#pragma warning disable 1591
public string Url { get; set; }
public int Timeout { get; set; }
public OutputFormats UploadFormat { get; set; }

View file

@ -27,8 +27,9 @@ namespace Greenshot.Addon.Confluence.Configuration.Impl
/// </summary>
[SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")]
#pragma warning disable CS1591
public class ConfluenceLanguageImpl : LanguageBase<IConfluenceLanguage>, IConfluenceLanguage
internal class ConfluenceLanguageImpl : LanguageBase<IConfluenceLanguage>, IConfluenceLanguage
{
#pragma warning disable 1591
public string PluginSettings { get; }
public string LoginError { get; }
public string LabelUrl { get; }

View file

@ -98,9 +98,13 @@ namespace Greenshot.Addon.Confluence
_page = page;
}
/// <summary>
/// Is the destination initialized?
/// </summary>
public static bool IsInitialized { get; private set; }
public override string Description
/// <inheritdoc />
public override string Description
{
get
{
@ -112,9 +116,11 @@ namespace Greenshot.Addon.Confluence
}
}
public override bool IsDynamic => true;
/// <inheritdoc />
public override bool IsDynamic => true;
public override bool IsActive => base.IsActive && !string.IsNullOrEmpty(_confluenceConfiguration.Url);
/// <inheritdoc />
public override bool IsActive => base.IsActive && !string.IsNullOrEmpty(_confluenceConfiguration.Url);
public override IBitmapWithNativeSupport DisplayIcon => ConfluenceIcon;
@ -131,7 +137,8 @@ namespace Greenshot.Addon.Confluence
}
}
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
/// <inheritdoc />
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
{
var exportInformation = new ExportInformation(Designation, Description);
// force password check to take place before the pages load

View file

@ -29,6 +29,9 @@ using Greenshot.Core.Enums;
namespace Greenshot.Addon.Confluence.ViewModels
{
/// <summary>
/// View model for the confluence configuration
/// </summary>
public sealed class ConfluenceConfigViewModel : SimpleConfigScreen
{
/// <summary>
@ -50,6 +53,7 @@ namespace Greenshot.Addon.Confluence.ViewModels
GreenshotLanguage = greenshotLanguage;
}
/// <inheritdoc />
public override void Initialize(IConfig config)
{
// Prepare disposables
@ -69,6 +73,7 @@ namespace Greenshot.Addon.Confluence.ViewModels
base.Initialize(config);
}
/// <inheritdoc />
protected override void OnDeactivate(bool close)
{
_disposables.Dispose();

View file

@ -21,10 +21,14 @@ using Dapplo.Config.Language;
namespace Greenshot.Addon.Dropbox.Configuration
{
/// <summary>
/// Translations for the dropbox add-on
/// </summary>
[Language("Dropbox")]
public interface IDropboxLanguage : ILanguage
{
string CommunicationWait { get; }
#pragma warning disable 1591
string CommunicationWait { get; }
string Configure { get; }

View file

@ -25,8 +25,13 @@ using Greenshot.Core.Enums;
namespace Greenshot.Addon.Dropbox.Configuration.Impl
{
/// <summary>
/// Implementation of the IDropboxConfiguration
/// </summary>
public class DropboxConfigurationImpl : IniSectionBase<IDropboxConfiguration>, IDropboxConfiguration
{
#pragma warning disable 1591
public string OutputFilePath { get; set; }
public bool OutputFileAllowOverwrite { get; set; }
public string OutputFileFilenamePattern { get; set; }

View file

@ -45,6 +45,9 @@ using Newtonsoft.Json;
namespace Greenshot.Addon.Dropbox
{
/// <summary>
/// This is the destination implementation to export to dropbox
/// </summary>
[Destination("Dropbox")]
public sealed class DropboxDestination : AbstractDestination
{
@ -60,7 +63,18 @@ namespace Greenshot.Addon.Dropbox
private OAuth2Settings _oAuth2Settings;
private IHttpBehaviour _oAuthHttpBehaviour;
public DropboxDestination(
/// <summary>
/// DI Coonstructor
/// </summary>
/// <param name="dropboxPluginConfiguration">IDropboxConfiguration</param>
/// <param name="dropboxLanguage">IDropboxLanguage</param>
/// <param name="httpConfiguration">IHttpConfiguration</param>
/// <param name="resourceProvider">IResourceProvider</param>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="exportNotification">ExportNotification</param>
/// <param name="pleaseWaitFormFactory">Func</param>
public DropboxDestination(
IDropboxConfiguration dropboxPluginConfiguration,
IDropboxLanguage dropboxLanguage,
IHttpConfiguration httpConfiguration,
@ -105,6 +119,7 @@ namespace Greenshot.Addon.Dropbox
httpBehaviour.HttpSettings = httpConfiguration;
}
/// <inheritdoc />
public override IBitmapWithNativeSupport DisplayIcon
{
get
@ -117,9 +132,11 @@ namespace Greenshot.Addon.Dropbox
}
}
public override string Description => _dropboxLanguage.UploadMenuItem;
/// <inheritdoc />
public override string Description => _dropboxLanguage.UploadMenuItem;
public override async Task<ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
/// <inheritdoc />
public override async Task<ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
{
var exportInformation = new ExportInformation(Designation, Description);
var uploadUrl = await UploadAsync(surface).ConfigureAwait(true);

View file

@ -36,12 +36,27 @@ namespace Greenshot.Addon.Dropbox.ViewModels
/// </summary>
private CompositeDisposable _disposables;
/// <summary>
/// Provide IDropboxConfiguration to the view
/// </summary>
public IDropboxConfiguration DropboxConfiguration { get; set; }
/// <summary>
/// Provide IDropboxLanguage to the view
/// </summary>
public IDropboxLanguage DropboxLanguage { get; set; }
/// <summary>
/// Provide FileConfigPartViewModel to the view
/// </summary>
public FileConfigPartViewModel FileConfigPartViewModel { get; private set; }
/// <summary>
/// DI constructor
/// </summary>
/// <param name="dropboxConfiguration">IDropboxConfiguration</param>
/// <param name="dropboxLanguage">IDropboxLanguage</param>
/// <param name="fileConfigPartViewModel">FileConfigPartViewModel</param>
public DropboxConfigViewModel(
IDropboxConfiguration dropboxConfiguration,
IDropboxLanguage dropboxLanguage,
@ -53,6 +68,7 @@ namespace Greenshot.Addon.Dropbox.ViewModels
FileConfigPartViewModel = fileConfigPartViewModel;
}
/// <inheritdoc />
public override void Initialize(IConfig config)
{
FileConfigPartViewModel.DestinationFileConfiguration = DropboxConfiguration;
@ -75,6 +91,7 @@ namespace Greenshot.Addon.Dropbox.ViewModels
base.Initialize(config);
}
/// <inheritdoc />
protected override void OnDeactivate(bool close)
{
_disposables.Dispose();

View file

@ -23,6 +23,7 @@ using System.Diagnostics.CodeAnalysis;
using Dapplo.Config.Ini;
using Greenshot.Addon.ExternalCommand.Entities;
using Greenshot.Addons.Core;
#pragma warning disable 1591
namespace Greenshot.Addon.ExternalCommand.Configuration
{

View file

@ -19,9 +19,13 @@
using System.Diagnostics.CodeAnalysis;
using Dapplo.Config.Language;
#pragma warning disable 1591
namespace Greenshot.Addon.ExternalCommand.Configuration
{
/// <summary>
/// These are the translations for the external command settings
/// </summary>
[Language("ExternalCommand")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public interface IExternalCommandLanguage : ILanguage

View file

@ -19,6 +19,9 @@
namespace Greenshot.Addon.ExternalCommand.Entities
{
/// <summary>
/// This defines an external command
/// </summary>
public class ExternalCommandDefinition
{
/// <summary>

View file

@ -29,7 +29,7 @@ using Greenshot.Addons.ViewModels;
namespace Greenshot.Addon.ExternalCommand.ViewModels
{
/// <summary>
/// Configuration for the external commands
/// Configuration for the external commands add-on
/// </summary>
public sealed class ExternalCommandConfigViewModel : SimpleConfigScreen
{
@ -38,15 +38,39 @@ namespace Greenshot.Addon.ExternalCommand.ViewModels
/// </summary>
private CompositeDisposable _disposables;
/// <summary>
/// Provide the IExternalCommandConfiguration to the view
/// </summary>
public IExternalCommandConfiguration ExternalCommandConfiguration { get; }
/// <summary>
/// Provide the IExternalCommandLanguage to the view
/// </summary>
public IExternalCommandLanguage ExternalCommandLanguage { get; }
/// <summary>
/// Provide the IGreenshotLanguage to the view
/// </summary>
public IGreenshotLanguage GreenshotLanguage { get; }
/// <summary>
/// Provide the FileConfigPartViewModel to the view
/// </summary>
public FileConfigPartViewModel FileConfigPartViewModel { get; private set; }
/// <summary>
/// Provide the ExternalCommandMasterViewModel to the view
/// </summary>
public ExternalCommandMasterViewModel ExternalCommandMasterViewModel { get; }
/// <summary>
/// DI constructor
/// </summary>
/// <param name="externalCommandConfiguration">IExternalCommandConfiguration</param>
/// <param name="externalCommandLanguage">IExternalCommandLanguage</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="fileConfigPartViewModel">FileConfigPartViewModel</param>
/// <param name="externalCommandMasterViewModel">ExternalCommandMasterViewModel</param>
public ExternalCommandConfigViewModel(
IExternalCommandConfiguration externalCommandConfiguration,
IExternalCommandLanguage externalCommandLanguage,
@ -61,6 +85,7 @@ namespace Greenshot.Addon.ExternalCommand.ViewModels
ExternalCommandMasterViewModel = externalCommandMasterViewModel;
}
/// <inheritdoc />
public override void Initialize(IConfig config)
{
FileConfigPartViewModel.DestinationFileConfiguration = ExternalCommandConfiguration;
@ -83,18 +108,21 @@ namespace Greenshot.Addon.ExternalCommand.ViewModels
base.Initialize(config);
}
/// <inheritdoc />
protected override void OnActivate()
{
base.OnActivate();
ExternalCommandMasterViewModel.ActivateWith(this);
}
/// <inheritdoc />
protected override void OnDeactivate(bool close)
{
_disposables.Dispose();
base.OnDeactivate(close);
}
/// <inheritdoc />
public override void Commit()
{
ExternalCommandMasterViewModel.Store();

View file

@ -22,11 +22,16 @@ using Dapplo.Config.Language;
namespace Greenshot.Addon.Flickr.Configuration
{
/// <summary>
/// Translations for the flickr add-on
/// </summary>
[Language("Flickr")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public interface IFlickrLanguage : ILanguage
{
string CommunicationWait { get; }
#pragma warning disable 1591
string CommunicationWait { get; }
string Configure { get; }

View file

@ -27,14 +27,15 @@ using Greenshot.Addons.Core;
namespace Greenshot.Addon.GooglePhotos.Configuration
{
/// <summary>
/// Description of GooglePhotosConfiguration.
/// Configuration for the google photos add-on
/// </summary>
[IniSection("GooglePhotos")]
[Description("Greenshot Google Photos Plugin configuration")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public interface IGooglePhotosConfiguration : IIniSection, IDestinationFileConfiguration, IOAuth2Token
{
[Description("After upload send Google Photos link to clipboard.")]
#pragma warning disable 1591
[Description("After upload send Google Photos link to clipboard.")]
[DefaultValue(true)]
bool AfterUploadLinkToClipBoard { get; set; }

View file

@ -22,10 +22,15 @@ using Dapplo.Config.Language;
namespace Greenshot.Addon.GooglePhotos.Configuration
{
/// <summary>
/// Translations for the google photos add-on
/// </summary>
[Language("GooglePhotos")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public interface IGooglePhotosLanguage : ILanguage
{
#pragma warning disable 1591
string CommunicationWait { get; }
string Configure { get; }

View file

@ -94,9 +94,11 @@ namespace Greenshot.Addon.GooglePhotos
};
}
public override string Description => _googlePhotosLanguage.UploadMenuItem;
/// <inheritdoc />
public override string Description => _googlePhotosLanguage.UploadMenuItem;
public override IBitmapWithNativeSupport DisplayIcon
/// <inheritdoc />
public override IBitmapWithNativeSupport DisplayIcon
{
get
{
@ -108,7 +110,8 @@ namespace Greenshot.Addon.GooglePhotos
}
}
public override async Task<ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
/// <inheritdoc />
public override async Task<ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
{
var exportInformation = new ExportInformation(Designation, Description);
var uploadUrl = await Upload(surface).ConfigureAwait(true);

View file

@ -28,13 +28,15 @@ using Greenshot.Addons.Core;
namespace Greenshot.Addon.Imgur.Configuration
{
/// <summary>
/// Description of ImgurConfiguration.
/// Configuration for the Imgur add-on
/// </summary>
[IniSection("Imgur")]
[Description("Greenshot Imgur Plugin configuration")]
public interface IImgurConfiguration : IIniSection, IDestinationFileConfiguration, IOAuth2Token
{
[Description("Url to Imgur system.")]
#pragma warning disable 1591
[Description("Url to Imgur system.")]
[DefaultValue("https://api.imgur.com/3")]
string ImgurApi3Url { get; set; }

View file

@ -22,11 +22,16 @@ using Dapplo.Config.Language;
namespace Greenshot.Addon.Imgur.Configuration
{
/// <summary>
/// Translations for the Imgur add-on
/// </summary>
[Language("Imgur")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public interface IImgurLanguage : ILanguage
{
string Cancel { get; }
#pragma warning disable 1591
string Cancel { get; }
string ClearQuestion { get; }

View file

@ -29,6 +29,7 @@ namespace Greenshot.Addon.Imgur.Entities
/// </summary>
public class ImgurData
{
#pragma warning disable 1591
/// <summary>
/// Id of the image
/// </summary>

View file

@ -27,6 +27,7 @@ namespace Greenshot.Addon.Imgur.Entities
/// </summary>
public class ImgurImage
{
#pragma warning disable 1591
[JsonIgnore]
public IBitmapWithNativeSupport Image { get; set; }

View file

@ -31,7 +31,7 @@ using Greenshot.Addons.ViewModels;
namespace Greenshot.Addon.Imgur.ViewModels
{
/// <summary>
/// The imgure config VM
/// The imgur config view model
/// </summary>
public sealed class ImgurConfigViewModel : SimpleConfigScreen
{
@ -39,17 +39,36 @@ namespace Greenshot.Addon.Imgur.ViewModels
/// Here all disposables are registered, so we can clean the up
/// </summary>
private CompositeDisposable _disposables;
private Func<Owned<ImgurHistoryViewModel>> ImgurHistoryViewModelFactory { get; }
/// <summary>
/// Provide IImgurConfiguration to the view
/// </summary>
public IImgurConfiguration ImgurConfiguration { get; }
/// <summary>
/// Provide IImgurLanguage to the view
/// </summary>
public IImgurLanguage ImgurLanguage { get; }
/// <summary>
/// Provide IWindowManager to the view
/// </summary>
public IWindowManager WindowManager { get; }
public Func<Owned<ImgurHistoryViewModel>> ImgurHistoryViewModelFactory { get;}
/// <summary>
/// Provide FileConfigPartViewModel to the view
/// </summary>
public FileConfigPartViewModel FileConfigPartViewModel { get; }
/// <summary>
/// DI constructor
/// </summary>
/// <param name="imgurConfiguration">IImgurConfiguration</param>
/// <param name="imgurLanguage">IImgurLanguage</param>
/// <param name="windowManager">IWindowManager</param>
/// <param name="imgurHistoryViewModelFactory">Func</param>
/// <param name="fileConfigPartViewModel">FileConfigPartViewModel</param>
public ImgurConfigViewModel(
IImgurConfiguration imgurConfiguration,
IImgurLanguage imgurLanguage ,
@ -64,6 +83,8 @@ namespace Greenshot.Addon.Imgur.ViewModels
ImgurHistoryViewModelFactory = imgurHistoryViewModelFactory;
FileConfigPartViewModel = fileConfigPartViewModel;
}
/// <inheritdoc />
public override void Initialize(IConfig config)
{
// Make sure the destination settings are shown
@ -87,12 +108,16 @@ namespace Greenshot.Addon.Imgur.ViewModels
base.Initialize(config);
}
/// <inheritdoc />
protected override void OnDeactivate(bool close)
{
_disposables.Dispose();
base.OnDeactivate(close);
}
/// <summary>
/// Show the Imgur history view model
/// </summary>
public void ShowHistory()
{
using (var imgurHistoryViewModel = ImgurHistoryViewModelFactory())
@ -101,8 +126,14 @@ namespace Greenshot.Addon.Imgur.ViewModels
}
}
/// <summary>
/// Can the credentials be reset?
/// </summary>
public bool CanResetCredentials => !ImgurConfiguration.AnonymousAccess && ImgurConfiguration.HasToken();
/// <summary>
/// Reset the credentials
/// </summary>
public void ResetCredentials()
{
ImgurConfiguration.ResetToken();

View file

@ -133,7 +133,7 @@ namespace Greenshot.Addon.InternetExplorer
}
/// <summary>
/// Gets a list of all IE Windows & tabs with the captions of the instances
/// Gets a list of all IE Windows and tabs with the captions of the instances
/// </summary>
/// <returns>List with KeyValuePair of InteropWindow and string</returns>
public IList<KeyValuePair<IInteropWindow, string>> GetBrowserTabs()

View file

@ -31,6 +31,9 @@ using IServiceProvider = Greenshot.Addons.Interop.IServiceProvider;
namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop
{
/// <summary>
/// This contains the document
/// </summary>
public class DocumentContainer
{
private const int E_ACCESSDENIED = unchecked((int) 0x80070005L);
@ -91,7 +94,12 @@ namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop
Init(document2, contentWindow);
}
public DocumentContainer(IHTMLDocument2 document2, IInteropWindow contentWindow)
/// <summary>
/// Constructor
/// </summary>
/// <param name="document2">IHTMLDocument2</param>
/// <param name="contentWindow">IInteropWindow</param>
public DocumentContainer(IHTMLDocument2 document2, IInteropWindow contentWindow)
{
Init(document2, contentWindow);
Log.Debug().WriteLine("Creating DocumentContainer for Document {0} found in window with rectangle {1}", Name, SourceRectangle);
@ -131,16 +139,34 @@ namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop
public string Name { get; private set; }
/// <summary>
/// Url of the document
/// </summary>
public string Url { get; private set; }
/// <summary>
/// Is this document hidden?
/// </summary>
public bool IsHidden => ClientWidth == 0 || ClientHeight == 0;
/// <summary>
/// Width of the client
/// </summary>
public int ClientWidth => ScaleX(GetAttributeAsInt("clientWidth"));
/// <summary>
/// Height of the client
/// </summary>
public int ClientHeight => ScaleY(GetAttributeAsInt("clientHeight"));
/// <summary>
/// Width of the scroll area
/// </summary>
public int ScrollWidth => ScaleX(GetAttributeAsInt("scrollWidth"));
/// <summary>
/// Height of the scroll area
/// </summary>
public int ScrollHeight => ScaleY(GetAttributeAsInt("scrollHeight"));
public NativePoint SourceLocation { get; set; }
@ -183,18 +209,27 @@ namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop
public int DestinationBottom => _destinationLocation.Y + ScrollHeight;
/// <summary>
/// Left of the scroll area
/// </summary>
public int ScrollLeft
{
get { return ScaleX(GetAttributeAsInt("scrollLeft")); }
set { SetAttribute("scrollLeft", UnscaleX(value)); }
}
/// <summary>
/// Top of the scroll area
/// </summary>
public int ScrollTop
{
get { return ScaleY(GetAttributeAsInt("scrollTop")); }
set { SetAttribute("scrollTop", UnscaleY(value)); }
}
/// <summary>
/// The list of frames
/// </summary>
public IList<DocumentContainer> Frames { get; } = new List<DocumentContainer>();
/// <summary>
@ -377,11 +412,11 @@ namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop
}
}
/// <summary>
/// Corrent the frame locations with the information
/// </summary>
/// <param name="frameElement"></param>
private void CorrectFrameLocations(IHTMLElement frameElement)
/// <summary>
/// Correct the frame locations with the information
/// </summary>
/// <param name="frameElement">IHTMLElement</param>
private void CorrectFrameLocations(IHTMLElement frameElement)
{
long x = 0;
long y = 0;

View file

@ -18,20 +18,13 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop
{
// IWebBrowser: EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B
// [ComVisible(true), ComImport(), Guid("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E"),
// TypeLibType(TypeLibTypeFlags.FDual),
// InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
// public interface IWebBrowser2 {
// [DispId(203)]
// object Document {
// [return: MarshalAs(UnmanagedType.IDispatch)]
// get;
// }
// }
/// <summary>
/// The IWebBrowser2 is used to communicate and automate Internet Explorer
/// </summary>
[ComImport]
[TypeLibType(TypeLibTypeFlags.FOleAutomation |
TypeLibTypeFlags.FDual |

View file

@ -30,7 +30,8 @@ namespace Greenshot.Addon.Jira.Configuration
[Description("Greenshot Jira Plugin configuration")]
public interface IJiraConfiguration : IIniSection, IDestinationFileConfiguration
{
[Description("Base url to Jira system, without anything else")]
#pragma warning disable 1591
[Description("Base url to Jira system, without anything else")]
[DefaultValue("https://jira")]
string Url { get; set; }

View file

@ -17,14 +17,18 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.ComponentModel;
using Dapplo.Config.Language;
namespace Greenshot.Addon.Jira.Configuration
{
/// <summary>
/// Translations for the Jira add-on
/// </summary>
[Language("Jira")]
public interface IJiraLanguage : ILanguage
{
#pragma warning disable 1591
string Cancel { get; }
string ColumnAssignee { get; }

View file

@ -26,6 +26,9 @@ using Greenshot.Addons.ViewModels;
namespace Greenshot.Addon.Jira.ViewModels
{
/// <summary>
/// This is the view model for the Jira configuration
/// </summary>
public sealed class JiraConfigViewModel : SimpleConfigScreen
{
/// <summary>
@ -33,12 +36,27 @@ namespace Greenshot.Addon.Jira.ViewModels
/// </summary>
private CompositeDisposable _disposables;
/// <summary>
/// Provide IJiraConfiguration to the view
/// </summary>
public IJiraConfiguration JiraConfiguration { get; }
/// <summary>
/// Provide IJiraLanguage to the view
/// </summary>
public IJiraLanguage JiraLanguage { get; }
/// <summary>
/// Provide FileConfigPartViewModel to the view
/// </summary>
public FileConfigPartViewModel FileConfigPartViewModel { get; }
/// <summary>
/// DI constructor
/// </summary>
/// <param name="jiraConfiguration">IJiraConfiguration</param>
/// <param name="jiraLanguage">IJiraLanguage</param>
/// <param name="fileConfigPartViewModel">FileConfigPartViewModel</param>
public JiraConfigViewModel(
IJiraConfiguration jiraConfiguration,
IJiraLanguage jiraLanguage,
@ -50,6 +68,7 @@ namespace Greenshot.Addon.Jira.ViewModels
FileConfigPartViewModel = fileConfigPartViewModel;
}
/// <inheritdoc />
public override void Initialize(IConfig config)
{
FileConfigPartViewModel.DestinationFileConfiguration = JiraConfiguration;
@ -71,6 +90,7 @@ namespace Greenshot.Addon.Jira.ViewModels
base.Initialize(config);
}
/// <inheritdoc />
protected override void OnDeactivate(bool close)
{
_disposables.Dispose();

View file

@ -29,6 +29,9 @@ using Greenshot.Addon.Jira.Configuration;
namespace Greenshot.Addon.Jira.ViewModels
{
/// <summary>
/// The view model for a Jira
/// </summary>
public sealed class JiraViewModel : Screen
{
/// <summary>
@ -36,13 +39,29 @@ namespace Greenshot.Addon.Jira.ViewModels
/// </summary>
private CompositeDisposable _disposables;
/// <summary>
/// Provide IJiraConfiguration to the view
/// </summary>
public IJiraConfiguration JiraConfiguration { get; }
/// <summary>
/// Provide IJiraLanguage to the view
/// </summary>
public IJiraLanguage JiraLanguage { get; }
/// <summary>
/// Provide JiraConnector to the view
/// </summary>
public JiraConnector JiraConnector { get; }
/// <summary>
/// DI constructor
/// </summary>
/// <param name="jiraConfiguration">IJiraConfiguration</param>
/// <param name="jiraLanguage">IJiraLanguage</param>
/// <param name="jiraConnector">JiraConnector</param>
public JiraViewModel(
IJiraConfiguration jiraConfiguration,
IJiraLanguage jiraLanguage,
@ -73,7 +92,7 @@ namespace Greenshot.Addon.Jira.ViewModels
/// </summary>
public string Filename { get; set; }
/// <inheritdoc />
protected override void OnActivate()
{
// Prepare disposables
@ -121,10 +140,11 @@ namespace Greenshot.Addon.Jira.ViewModels
}
/// <summary>
///
/// Can this be uploaded?
/// </summary>
public bool CanUpload { get; private set; }
/// <inheritdoc />
protected override void OnDeactivate(bool close)
{
_disposables.Dispose();

View file

@ -56,7 +56,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
}
}
public virtual EditStatus EditStatus { get; protected set; } = EditStatus.IDLE;
public virtual EditStatus EditStatus { get; protected set; } = EditStatus.Idle;
/// <summary>
/// Returns the cursor for when the mouse is over the adorner
@ -101,7 +101,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
/// <param name="mouseEventArgs"></param>
public virtual void MouseUp(object sender, MouseEventArgs mouseEventArgs)
{
EditStatus = EditStatus.IDLE;
EditStatus = EditStatus.Idle;
}
/// <summary>
@ -109,7 +109,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
/// </summary>
public virtual bool IsActive
{
get { return EditStatus != EditStatus.IDLE && EditStatus != EditStatus.UNDRAWN; }
get { return EditStatus != EditStatus.Idle && EditStatus != EditStatus.Undrawn; }
}
/// <summary>

View file

@ -101,7 +101,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
/// <param name="mouseEventArgs"></param>
public override void MouseDown(object sender, MouseEventArgs mouseEventArgs)
{
EditStatus = EditStatus.RESIZING;
EditStatus = EditStatus.Resizing;
_boundsBeforeResize = new NativeRectFloat(Owner.Left, Owner.Top, Owner.Width, Owner.Height);
_boundsAfterResize = _boundsBeforeResize;
_initialMoveAfterMouseDown = true;
@ -115,7 +115,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
/// <param name="mouseEventArgs"></param>
public override void MouseMove(object sender, MouseEventArgs mouseEventArgs)
{
if (EditStatus != EditStatus.RESIZING)
if (EditStatus != EditStatus.Resizing)
{
return;
}

View file

@ -128,7 +128,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
/// <param name="mouseEventArgs"></param>
public override void MouseDown(object sender, MouseEventArgs mouseEventArgs)
{
EditStatus = EditStatus.RESIZING;
EditStatus = EditStatus.Resizing;
_boundsBeforeResize = new NativeRectFloat(Owner.Left, Owner.Top, Owner.Width, Owner.Height);
_boundsAfterResize = _boundsBeforeResize;
}
@ -140,7 +140,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
/// <param name="mouseEventArgs"></param>
public override void MouseMove(object sender, MouseEventArgs mouseEventArgs)
{
if (EditStatus != EditStatus.RESIZING)
if (EditStatus != EditStatus.Resizing)
{
return;
}

View file

@ -46,7 +46,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
/// <param name="mouseEventArgs"></param>
public override void MouseDown(object sender, MouseEventArgs mouseEventArgs)
{
EditStatus = EditStatus.MOVING;
EditStatus = EditStatus.Moving;
}
/// <summary>
@ -56,7 +56,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners
/// <param name="mouseEventArgs"></param>
public override void MouseMove(object sender, MouseEventArgs mouseEventArgs)
{
if (EditStatus != EditStatus.MOVING)
if (EditStatus != EditStatus.Moving)
{
return;
}

View file

@ -65,7 +65,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
protected override void InitializeFields()
{
AddField(GetType(), FieldTypes.FLAGS, FieldFlag.CONFIRMABLE);
AddField(GetType(), FieldTypes.FLAGS, FieldFlag.Confirmable);
}
public override void Invalidate()

View file

@ -65,7 +65,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
// will store current bounds of this DrawableContainer before starting a resize
protected NativeRect _boundsBeforeResize = NativeRect.Empty;
protected EditStatus _defaultEditMode = EditStatus.DRAWING;
protected EditStatus _defaultEditMode = EditStatus.Drawing;
[NonSerialized] internal Surface _parent;
@ -73,7 +73,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
[NonSerialized] private bool _selected;
[NonSerialized] private EditStatus _status = EditStatus.UNDRAWN;
[NonSerialized] private EditStatus _status = EditStatus.Undrawn;
[NonSerialized] private TargetAdorner _targetAdorner;
@ -325,7 +325,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
public virtual void Invalidate()
{
if (Status != EditStatus.UNDRAWN)
if (Status != EditStatus.Undrawn)
{
_parent?.Invalidate(DrawingBounds);
}
@ -351,15 +351,15 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
Left = _parent.Width / 2 - Width / 2 - lineThickness / 2;
}
if (verticalAlignment == VerticalAlignment.TOP)
if (verticalAlignment == VerticalAlignment.Top)
{
Top = lineThickness / 2;
}
if (verticalAlignment == VerticalAlignment.BOTTOM)
if (verticalAlignment == VerticalAlignment.Bottom)
{
Top = _parent.Height - Height - lineThickness / 2;
}
if (verticalAlignment == VerticalAlignment.CENTER)
if (verticalAlignment == VerticalAlignment.Center)
{
Top = _parent.Height / 2 - Height / 2 - lineThickness / 2;
}
@ -560,7 +560,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
{
if (Children.Count > 0)
{
if (Status != EditStatus.IDLE)
if (Status != EditStatus.Idle)
{
DrawSelectionBorder(graphics, Bounds);
}

View file

@ -209,7 +209,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
/// <returns>true if an filter intersects</returns>
public bool HasIntersectingFilters(NativeRect clipRectangle) {
foreach(var dc in this) {
if (dc.DrawingBounds.IntersectsWith(clipRectangle) && dc.HasFilters && dc.Status == EditStatus.IDLE) {
if (dc.DrawingBounds.IntersectsWith(clipRectangle) && dc.HasFilters && dc.Status == EditStatus.Idle) {
return true;
}
}
@ -233,11 +233,11 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
/// <summary>
/// Triggers all elements in the list ot be redrawn.
/// </summary>
/// <param name="g">the to the bitmap related Graphics object</param>
/// <param name="graphics">the to the bitmap related Graphics object</param>
/// <param name="bitmap">IBitmapWithNativeSupport to draw</param>
/// <param name="renderMode">the rendermode in which the element is to be drawn</param>
/// <param name="clipRectangle"></param>
public void Draw(Graphics g, IBitmapWithNativeSupport bitmap, RenderMode renderMode, NativeRect clipRectangle) {
public void Draw(Graphics graphics, IBitmapWithNativeSupport bitmap, RenderMode renderMode, NativeRect clipRectangle) {
if (Parent == null)
{
return;
@ -251,7 +251,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing {
}
if (dc.DrawingBounds.IntersectsWith(clipRectangle))
{
dc.DrawContent(g, bitmap, renderMode, clipRectangle);
dc.DrawContent(graphics, bitmap, renderMode, clipRectangle);
}
}
}

View file

@ -41,12 +41,14 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields
/// </summary>
public Type ValueType { get; }= typeof(T);
public override string ToString()
/// <inheritdoc />
public override string ToString()
{
return Name;
}
public override int GetHashCode()
/// <inheritdoc />
public override int GetHashCode()
{
var hashCode = 0;
unchecked
@ -59,7 +61,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields
return hashCode;
}
public override bool Equals(object obj)
/// <inheritdoc />
public override bool Equals(object obj)
{
var other = obj as FieldType<T>;
if (other == null)
@ -69,12 +72,24 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields
return Equals(Name, other.Name);
}
public static bool operator ==(FieldType<T> a, FieldType<T> b)
/// <summary>
/// Implements a equals operator
/// </summary>
/// <param name="a">FieldType</param>
/// <param name="b">FieldType</param>
/// <returns>bool</returns>
public static bool operator ==(FieldType<T> a, FieldType<T> b)
{
return Equals(a, b);
}
public static bool operator !=(FieldType<T> a, FieldType<T> b)
/// <summary>
/// Implements a not equals operator
/// </summary>
/// <param name="a">FieldType</param>
/// <param name="b">FieldType</param>
/// <returns>bool</returns>
public static bool operator !=(FieldType<T> a, FieldType<T> b)
{
return !Equals(a, b);
}

View file

@ -28,27 +28,87 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields
/// </summary>
public static class FieldTypes
{
/// <summary>
/// This field specifies which arrow heads are used
/// </summary>
public static readonly IFieldType ARROWHEADS = new FieldType<ArrowContainer.ArrowHeadCombination>("ARROWHEADS");
/// <summary>
/// This field specifies the blur radius
/// </summary>
public static readonly IFieldType BLUR_RADIUS = new FieldType<int>("BLUR_RADIUS");
/// <summary>
/// This field specifies the brightness of a filter
/// </summary>
public static readonly IFieldType BRIGHTNESS = new FieldType<double>("BRIGHTNESS");
/// <summary>
/// This field specifies the fill color
/// </summary>
public static readonly IFieldType FILL_COLOR = new FieldType<Color>("FILL_COLOR");
/// <summary>
/// This field specifies if the font is bold
/// </summary>
public static readonly IFieldType FONT_BOLD = new FieldType<bool>("FONT_BOLD");
/// <summary>
/// This field specifies the font family
/// </summary>
public static readonly IFieldType FONT_FAMILY = new FieldType<string>("FONT_FAMILY");
/// <summary>
/// This field specifies if the font is italic
/// </summary>
public static readonly IFieldType FONT_ITALIC = new FieldType<bool>("FONT_ITALIC");
/// <summary>
/// This field specifies the font size
/// </summary>
public static readonly IFieldType FONT_SIZE = new FieldType<int>("FONT_SIZE");
/// <summary>
/// This field specifies the horizontal text alignment
/// </summary>
public static readonly IFieldType TEXT_HORIZONTAL_ALIGNMENT = new FieldType<StringAlignment>("TEXT_HORIZONTAL_ALIGNMENT");
/// <summary>
/// This field specifies the vertical text alignment
/// </summary>
public static readonly IFieldType TEXT_VERTICAL_ALIGNMENT = new FieldType<StringAlignment>("TEXT_VERTICAL_ALIGNMENT");
/// <summary>
/// This field specifies the highlight color
/// </summary>
public static readonly IFieldType HIGHLIGHT_COLOR = new FieldType<Color>("HIGHLIGHT_COLOR");
/// <summary>
/// This field specifies the line color
/// </summary>
public static readonly IFieldType LINE_COLOR = new FieldType<Color>("LINE_COLOR");
/// <summary>
/// This field specifies the line thickness
/// </summary>
public static readonly IFieldType LINE_THICKNESS = new FieldType<int>("LINE_THICKNESS");
/// <summary>
/// This field specifies the magnification factor for the magnification filter
/// </summary>
public static readonly IFieldType MAGNIFICATION_FACTOR = new FieldType<int>("MAGNIFICATION_FACTOR");
/// <summary>
/// This field specifies the pixel size for the pixelate filter
/// </summary>
public static readonly IFieldType PIXEL_SIZE = new FieldType<int>("PIXEL_SIZE");
/// <summary>
/// This field specifies if a shadow should be rendered
/// </summary>
public static readonly IFieldType SHADOW = new FieldType<bool>("SHADOW");
public static readonly IFieldType PREPARED_FILTER_OBFUSCATE = new FieldType<FilterContainer.PreparedFilter>("PREPARED_FILTER_OBFUSCATE");
public static readonly IFieldType PREPARED_FILTER_HIGHLIGHT = new FieldType<FilterContainer.PreparedFilter>("PREPARED_FILTER_HIGHLIGHT");
/// <summary>
/// This field specifies if this is a obfuscate filter
/// </summary>
public static readonly IFieldType PREPARED_FILTER_OBFUSCATE = new FieldType<PreparedFilter>("PREPARED_FILTER_OBFUSCATE");
/// <summary>
/// This field specifies if this is a highlight filter
/// </summary>
public static readonly IFieldType PREPARED_FILTER_HIGHLIGHT = new FieldType<PreparedFilter>("PREPARED_FILTER_HIGHLIGHT");
/// <summary>
/// This field specifies some flags
/// </summary>
public static readonly IFieldType FLAGS = new FieldType<FieldFlag>("FLAGS");
public static IFieldType[] Values =
/// <summary>
/// All values
/// </summary>
public static readonly IFieldType[] Values =
{
ARROWHEADS, BLUR_RADIUS, BRIGHTNESS, FILL_COLOR, FONT_BOLD, FONT_FAMILY, FONT_ITALIC, FONT_SIZE, TEXT_HORIZONTAL_ALIGNMENT, TEXT_VERTICAL_ALIGNMENT, HIGHLIGHT_COLOR, LINE_COLOR, LINE_THICKNESS, MAGNIFICATION_FACTOR, PIXEL_SIZE, SHADOW, PREPARED_FILTER_OBFUSCATE, PREPARED_FILTER_HIGHLIGHT, FLAGS
};

View file

@ -34,33 +34,18 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
[Serializable]
public abstract class FilterContainer : DrawableContainer
{
public enum PreparedFilter
{
BLUR,
PIXELIZE,
TEXT_HIGHTLIGHT,
AREA_HIGHLIGHT,
GRAYSCALE,
MAGNIFICATION
}
public enum PreparedFilterMode
{
OBFUSCATE,
HIGHLIGHT
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="parent"></param>
/// <param name="editorConfiguration"></param>
public FilterContainer(Surface parent, IEditorConfiguration editorConfiguration) : base(parent, editorConfiguration)
{
Init();
}
public PreparedFilter Filter
{
get { return (PreparedFilter) GetFieldValue(FieldTypes.PREPARED_FILTER_HIGHLIGHT); }
}
protected override void OnDeserialized(StreamingContext streamingContext)
/// <inheritdoc />
protected override void OnDeserialized(StreamingContext streamingContext)
{
base.OnDeserialized(streamingContext);
Init();
@ -71,14 +56,16 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
CreateDefaultAdorners();
}
protected override void InitializeFields()
/// <inheritdoc />
protected override void InitializeFields()
{
AddField(GetType(), FieldTypes.LINE_THICKNESS, 0);
AddField(GetType(), FieldTypes.LINE_COLOR, Color.Red);
AddField(GetType(), FieldTypes.SHADOW, false);
}
public override void Draw(Graphics graphics, RenderMode rm)
/// <inheritdoc />
public override void Draw(Graphics graphics, RenderMode rm)
{
var lineThickness = GetFieldValueAsInt(FieldTypes.LINE_THICKNESS);
var lineColor = GetFieldValueAsColor(FieldTypes.LINE_COLOR);
@ -93,8 +80,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
//draw shadow first
if (shadow)
{
var basealpha = 100;
var alpha = basealpha;
var baseAlpha = 100;
var alpha = baseAlpha;
var steps = 5;
var currentStep = lineVisible ? 1 : 0;
while (currentStep <= steps)
@ -104,7 +91,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
var shadowRect = new NativeRect(Left + currentStep, Top + currentStep, Width, Height).Normalize();
graphics.DrawRectangle(shadowPen, shadowRect);
currentStep++;
alpha = alpha - basealpha / steps;
alpha = alpha - baseAlpha / steps;
}
}
}

View file

@ -42,7 +42,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
protected override void InitializeFields()
{
base.InitializeFields();
AddField(GetType(), FieldTypes.PREPARED_FILTER_HIGHLIGHT, PreparedFilter.TEXT_HIGHTLIGHT);
AddField(GetType(), FieldTypes.PREPARED_FILTER_HIGHLIGHT, PreparedFilter.TextHightlight);
}
protected override void OnDeserialized(StreamingContext context)
@ -77,10 +77,10 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
}
switch (preset)
{
case PreparedFilter.TEXT_HIGHTLIGHT:
case PreparedFilter.TextHightlight:
Add(new HighlightFilter(this, _editorConfiguration));
break;
case PreparedFilter.AREA_HIGHLIGHT:
case PreparedFilter.AreaHighlight:
var brightnessFilter = new BrightnessFilter(this, _editorConfiguration)
{
Invert = true
@ -92,14 +92,14 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
};
Add(blurFilter);
break;
case PreparedFilter.GRAYSCALE:
case PreparedFilter.Grayscale:
AbstractFilter f = new GrayscaleFilter(this, _editorConfiguration)
{
Invert = true
};
Add(f);
break;
case PreparedFilter.MAGNIFICATION:
case PreparedFilter.Magnification:
Add(new MagnifierFilter(this, _editorConfiguration));
break;
}

View file

@ -39,7 +39,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
protected override void InitializeFields()
{
base.InitializeFields();
AddField(GetType(), FieldTypes.PREPARED_FILTER_OBFUSCATE, PreparedFilter.PIXELIZE);
AddField(GetType(), FieldTypes.PREPARED_FILTER_OBFUSCATE, PreparedFilter.Pixelize);
}
protected override void OnDeserialized(StreamingContext context)
@ -74,10 +74,10 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
}
switch (preset)
{
case PreparedFilter.BLUR:
case PreparedFilter.Blur:
Add(new BlurFilter(this, _editorConfiguration));
break;
case PreparedFilter.PIXELIZE:
case PreparedFilter.Pixelize:
Add(new PixelizationFilter(this, _editorConfiguration));
break;
}

View file

@ -0,0 +1,54 @@
// Dapplo - building blocks for desktop applications
// Copyright (C) 2019 Dapplo
//
// For more information see: http://dapplo.net/
// Dapplo repositories are hosted on GitHub: https://github.com/dapplo
//
// This file is part of Greenshot-Full
//
// Greenshot-Full is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Greenshot-Full is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have a copy of the GNU Lesser General Public License
// along with Greenshot-Full. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
//
namespace Greenshot.Addon.LegacyEditor.Drawing
{
/// <summary>
/// Defines the filter to use
/// </summary>
public enum PreparedFilter
{
/// <summary>
/// Use the blur filter
/// </summary>
Blur,
/// <summary>
/// Use the pixelize filter
/// </summary>
Pixelize,
/// <summary>
/// Use the text highlight filter
/// </summary>
TextHightlight,
/// <summary>
/// Use the area highlight filter
/// </summary>
AreaHighlight,
/// <summary>
/// Use the gray-scale filter
/// </summary>
Grayscale,
/// <summary>
/// Use the magnification filter
/// </summary>
Magnification
}
}

View file

@ -50,7 +50,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
{
get
{
if (Status != EditStatus.UNDRAWN)
if (Status != EditStatus.Undrawn)
{
var lineThickness = GetFieldValueAsInt(FieldTypes.LINE_THICKNESS);
var lineColor = GetFieldValueAsColor(FieldTypes.LINE_COLOR);
@ -324,7 +324,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
return true;
}
var clickedPoint = new NativePoint(x, y);
if (Status != EditStatus.UNDRAWN)
if (Status != EditStatus.Undrawn)
{
var lineThickness = GetFieldValueAsInt(FieldTypes.LINE_THICKNESS);
var lineColor = GetFieldValueAsColor(FieldTypes.LINE_COLOR);

View file

@ -93,7 +93,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
public override bool InitContent()
{
_defaultEditMode = EditStatus.IDLE;
_defaultEditMode = EditStatus.Idle;
_stringFormat.Alignment = StringAlignment.Center;
_stringFormat.LineAlignment = StringAlignment.Center;
@ -119,7 +119,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
{
AddField(GetType(), FieldTypes.FILL_COLOR, Color.DarkRed);
AddField(GetType(), FieldTypes.LINE_COLOR, Color.White);
AddField(GetType(), FieldTypes.FLAGS, FieldFlag.COUNTER);
AddField(GetType(), FieldTypes.FLAGS, FieldFlag.Counter);
}
/// <summary>

View file

@ -637,9 +637,9 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
container.FieldChanged += Element_FieldChanged;
}
element.Parent = this;
if (element.Status == EditStatus.UNDRAWN)
if (element.Status == EditStatus.Undrawn)
{
element.Status = EditStatus.IDLE;
element.Status = EditStatus.Idle;
}
if (element.Selected)
{
@ -914,7 +914,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
if (text != null)
{
DeselectAllElements();
var textContainer = AddTextContainer(text, HorizontalAlignment.Center, VerticalAlignment.CENTER,
var textContainer = AddTextContainer(text, HorizontalAlignment.Center, VerticalAlignment.Center,
FontFamily.GenericSansSerif, 12f, false, false, false, 2, Color.Black, Color.Transparent);
SelectElement(textContainer);
}
@ -1229,7 +1229,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
_undrawnElement.Top = cropRectangle.Y;
_undrawnElement.Width = cropRectangle.Width;
_undrawnElement.Height = cropRectangle.Height;
_undrawnElement.Status = EditStatus.UNDRAWN;
_undrawnElement.Status = EditStatus.Undrawn;
AddElement(_undrawnElement);
SelectElement(_undrawnElement);
_drawingElement = null;
@ -1454,7 +1454,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
if (_mouseDownElement != null)
{
_mouseDownElement.Status = EditStatus.MOVING;
_mouseDownElement.Status = EditStatus.Moving;
}
}
}
@ -1476,10 +1476,10 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
var currentMouse = new NativePoint(e.X, e.Y);
_elements.Status = EditStatus.IDLE;
_elements.Status = EditStatus.Idle;
if (_mouseDownElement != null)
{
_mouseDownElement.Status = EditStatus.IDLE;
_mouseDownElement.Status = EditStatus.Idle;
}
_mouseDown = false;
_mouseDownElement = null;

View file

@ -196,11 +196,11 @@ namespace Greenshot.Addon.LegacyEditor.Drawing
{
HideTextBox();
}
else if (Selected && Status == EditStatus.DRAWING)
else if (Selected && Status == EditStatus.Drawing)
{
ShowTextBox();
}
else if (_parent != null && Selected && Status == EditStatus.IDLE && _textBox.Visible)
else if (_parent != null && Selected && Status == EditStatus.Idle && _textBox.Visible)
{
// Fix (workaround) for BUG-1698
_parent.KeysLocked = true;

View file

@ -86,8 +86,8 @@ namespace Greenshot.Addon.LegacyEditor
case var fieldFlagType when fieldType.ValueType == typeof(FieldFlag):
fieldValue = Enum.Parse(typeof(FieldFlag), preferredStringValue, true);
break;
case var preparedFilterType when fieldType.ValueType == typeof(FilterContainer.PreparedFilter):
fieldValue = Enum.Parse(typeof(FilterContainer.PreparedFilter), preferredStringValue, true);
case var preparedFilterType when fieldType.ValueType == typeof(PreparedFilter):
fieldValue = Enum.Parse(typeof(PreparedFilter), preferredStringValue, true);
break;
case var arrowHeadCombinationType when fieldType.ValueType == typeof(ArrowContainer.ArrowHeadCombination):
fieldValue = Enum.Parse(typeof(ArrowContainer.ArrowHeadCombination), preferredStringValue, true);

View file

@ -1022,20 +1022,20 @@ namespace Greenshot.Addon.LegacyEditor.Forms {
this.obfuscateModeButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.obfuscateModeButton.LanguageKey = "editor.editor_obfuscate_mode";
this.obfuscateModeButton.Name = "obfuscateModeButton";
this.obfuscateModeButton.SelectedTag = FilterContainer.PreparedFilter.BLUR;
this.obfuscateModeButton.Tag = FilterContainer.PreparedFilter.BLUR;
this.obfuscateModeButton.SelectedTag = PreparedFilter.Blur;
this.obfuscateModeButton.Tag = PreparedFilter.Blur;
//
// pixelizeToolStripMenuItem
//
this.pixelizeToolStripMenuItem.LanguageKey = "editor.editor_obfuscate_pixelize";
this.pixelizeToolStripMenuItem.Name = "pixelizeToolStripMenuItem";
this.pixelizeToolStripMenuItem.Tag = FilterContainer.PreparedFilter.PIXELIZE;
this.pixelizeToolStripMenuItem.Tag = PreparedFilter.Pixelize;
//
// blurToolStripMenuItem
//
this.blurToolStripMenuItem.LanguageKey = "editor.editor_obfuscate_blur";
this.blurToolStripMenuItem.Name = "blurToolStripMenuItem";
this.blurToolStripMenuItem.Tag = FilterContainer.PreparedFilter.BLUR;
this.blurToolStripMenuItem.Tag = PreparedFilter.Blur;
//
// highlightModeButton
//
@ -1048,32 +1048,32 @@ namespace Greenshot.Addon.LegacyEditor.Forms {
this.highlightModeButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.highlightModeButton.LanguageKey = "editor.editor_highlight_mode";
this.highlightModeButton.Name = "highlightModeButton";
this.highlightModeButton.SelectedTag = FilterContainer.PreparedFilter.TEXT_HIGHTLIGHT;
this.highlightModeButton.Tag = FilterContainer.PreparedFilter.TEXT_HIGHTLIGHT;
this.highlightModeButton.SelectedTag = PreparedFilter.TextHightlight;
this.highlightModeButton.Tag = PreparedFilter.TextHightlight;
//
// textHighlightMenuItem
//
this.textHighlightMenuItem.LanguageKey = "editor.editor_highlight_text";
this.textHighlightMenuItem.Name = "textHighlightMenuItem";
this.textHighlightMenuItem.Tag = FilterContainer.PreparedFilter.TEXT_HIGHTLIGHT;
this.textHighlightMenuItem.Tag = PreparedFilter.TextHightlight;
//
// areaHighlightMenuItem
//
this.areaHighlightMenuItem.LanguageKey = "editor.editor_highlight_area";
this.areaHighlightMenuItem.Name = "areaHighlightMenuItem";
this.areaHighlightMenuItem.Tag = FilterContainer.PreparedFilter.AREA_HIGHLIGHT;
this.areaHighlightMenuItem.Tag = PreparedFilter.AreaHighlight;
//
// grayscaleHighlightMenuItem
//
this.grayscaleHighlightMenuItem.LanguageKey = "editor.editor_highlight_grayscale";
this.grayscaleHighlightMenuItem.Name = "grayscaleHighlightMenuItem";
this.grayscaleHighlightMenuItem.Tag = FilterContainer.PreparedFilter.GRAYSCALE;
this.grayscaleHighlightMenuItem.Tag = PreparedFilter.Grayscale;
//
// magnifyMenuItem
//
this.magnifyMenuItem.LanguageKey = "editor.editor_highlight_magnify";
this.magnifyMenuItem.Name = "magnifyMenuItem";
this.magnifyMenuItem.Tag = FilterContainer.PreparedFilter.MAGNIFICATION;
this.magnifyMenuItem.Tag = PreparedFilter.Magnification;
//
// btnFillColor
//
@ -1312,7 +1312,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms {
//
this.magnificationFactorLabel.LanguageKey = "editor.editor_magnification_factor";
this.magnificationFactorLabel.Name = "magnificationFactorLabel";
this.magnificationFactorLabel.Tag = FilterContainer.PreparedFilter.MAGNIFICATION;
this.magnificationFactorLabel.Tag = PreparedFilter.Magnification;
//
// magnificationFactorUpDown
//

View file

@ -707,9 +707,9 @@ namespace Greenshot.Addon.LegacyEditor.Forms
textVerticalAlignmentButton.Visible = props.HasFieldValue(FieldTypes.TEXT_VERTICAL_ALIGNMENT);
shadowButton.Visible = props.HasFieldValue(FieldTypes.SHADOW);
counterLabel.Visible = counterUpDown.Visible = props.HasFieldValue(FieldTypes.FLAGS)
&& ((FieldFlag) props.GetFieldValue(FieldTypes.FLAGS) & FieldFlag.COUNTER) == FieldFlag.COUNTER;
&& ((FieldFlag) props.GetFieldValue(FieldTypes.FLAGS) & FieldFlag.Counter) == FieldFlag.Counter;
btnConfirm.Visible = btnCancel.Visible = props.HasFieldValue(FieldTypes.FLAGS)
&& ((FieldFlag) props.GetFieldValue(FieldTypes.FLAGS) & FieldFlag.CONFIRMABLE) == FieldFlag.CONFIRMABLE;
&& ((FieldFlag) props.GetFieldValue(FieldTypes.FLAGS) & FieldFlag.Confirmable) == FieldFlag.Confirmable;
obfuscateModeButton.Visible = props.HasFieldValue(FieldTypes.PREPARED_FILTER_OBFUSCATE);
highlightModeButton.Visible = props.HasFieldValue(FieldTypes.PREPARED_FILTER_HIGHLIGHT);
@ -749,7 +749,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms
var props = _surface.FieldAggregator;
// if a confirmable element is selected, we must disable most of the controls
// since we demand confirmation or cancel for confirmable element
if (props.HasFieldValue(FieldTypes.FLAGS) && ((FieldFlag) props.GetFieldValue(FieldTypes.FLAGS) & FieldFlag.CONFIRMABLE) == FieldFlag.CONFIRMABLE)
if (props.HasFieldValue(FieldTypes.FLAGS) && ((FieldFlag) props.GetFieldValue(FieldTypes.FLAGS) & FieldFlag.Confirmable) == FieldFlag.Confirmable)
{
// disable most controls
if (!_controlsDisabledDueToConfirmable)

View file

@ -22,9 +22,13 @@ using Dapplo.Config.Language;
namespace Greenshot.Addon.Lutim.Configuration
{
/// <summary>
/// Translations for the Lutim add-on
/// </summary>
[Language("Lutim")]
public interface ILutimLanguage : ILanguage, INotifyPropertyChanged
public interface ILutimLanguage : ILanguage
{
#pragma warning disable 1591
string Cancel { get; }
string ClearQuestion { get; }

View file

@ -1,9 +1,32 @@
using Newtonsoft.Json;
// Greenshot - a free and open source screenshot tool
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
//
// For more information see: http://getgreenshot.org/
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using Newtonsoft.Json;
namespace Greenshot.Addon.Lutim.Entities
{
/// <summary>
/// The result of calling add
/// </summary>
public class AddResult
{
#pragma warning disable 1591
[JsonProperty("success")]
public bool Success { get; set; }

View file

@ -1,4 +1,23 @@
using System;
// Greenshot - a free and open source screenshot tool
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
//
// For more information see: http://getgreenshot.org/
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Drawing;
using System.IO;
using Newtonsoft.Json;
@ -6,8 +25,12 @@ using Newtonsoft.Json.Converters;
namespace Greenshot.Addon.Lutim.Entities
{
/// <summary>
/// This is the entity which Lutim returns
/// </summary>
public class LutimInfo
{
#pragma warning disable 1591
[JsonProperty("real_short")]
public string RealShort { get; set; }

View file

@ -1,23 +1,21 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Greenshot - a free and open source screenshot tool
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
//
// For more information see: http://getgreenshot.org/
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Threading;
@ -52,6 +50,17 @@ namespace Greenshot.Addon.Lutim {
private readonly ExportNotification _exportNotification;
private readonly Func<CancellationTokenSource, Owned<PleaseWaitForm>> _pleaseWaitFormFactory;
/// <summary>
/// DI constructor
/// </summary>
/// <param name="lutimConfiguration">ILutimConfiguration</param>
/// <param name="lutimLanguage">ILutimLanguage</param>
/// <param name="lutimApi">LutimApi</param>
/// <param name="resourceProvider">IResourceProvider</param>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="exportNotification">ExportNotification</param>
/// <param name="pleaseWaitFormFactory">Func</param>
public LutimDestination(ILutimConfiguration lutimConfiguration,
ILutimLanguage lutimLanguage,
LutimApi lutimApi,
@ -70,9 +79,11 @@ namespace Greenshot.Addon.Lutim {
_pleaseWaitFormFactory = pleaseWaitFormFactory;
}
public override string Description => _lutimLanguage.UploadMenuItem;
/// <inheritdoc />
public override string Description => _lutimLanguage.UploadMenuItem;
public override IBitmapWithNativeSupport DisplayIcon {
/// <inheritdoc />
public override IBitmapWithNativeSupport DisplayIcon {
get {
// TODO: Optimize this by caching
using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "Lutim.png"))
@ -82,6 +93,7 @@ namespace Greenshot.Addon.Lutim {
}
}
/// <inheritdoc />
public override async Task<ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
{
var uploadUrl = await Upload(surface).ConfigureAwait(true);

View file

@ -36,10 +36,27 @@ namespace Greenshot.Addon.Lutim.ViewModels
/// </summary>
private CompositeDisposable _disposables;
/// <summary>
/// Provide ILutimConfiguration to the view
/// </summary>
public ILutimConfiguration LutimConfiguration { get; }
/// <summary>
/// Provide ILutimLanguage to the view
/// </summary>
public ILutimLanguage LutimLanguage { get; }
/// <summary>
/// Provide FileConfigPartViewModel to the view
/// </summary>
public FileConfigPartViewModel FileConfigPartViewModel { get; }
/// <summary>
/// DI constructor
/// </summary>
/// <param name="lutimConfiguration">ILutimConfiguration</param>
/// <param name="lutimLanguage">ILutimLanguage</param>
/// <param name="fileConfigPartViewModel">FileConfigPartViewModel</param>
public LutimConfigViewModel(
ILutimConfiguration lutimConfiguration,
ILutimLanguage lutimLanguage,
@ -50,6 +67,7 @@ namespace Greenshot.Addon.Lutim.ViewModels
FileConfigPartViewModel = fileConfigPartViewModel;
}
/// <inheritdoc />
public override void Initialize(IConfig config)
{
FileConfigPartViewModel.DestinationFileConfiguration = LutimConfiguration;
@ -72,6 +90,7 @@ namespace Greenshot.Addon.Lutim.ViewModels
base.Initialize(config);
}
/// <inheritdoc />
protected override void OnDeactivate(bool close)
{
_disposables.Dispose();

View file

@ -34,6 +34,9 @@ using Greenshot.Addons.Extensions;
namespace Greenshot.Addon.Lutim.ViewModels
{
/// <summary>
/// The view model for the Lutim history
/// </summary>
public sealed class LutimHistoryViewModel : Screen
{
private static readonly LogSource Log = new LogSource();
@ -44,10 +47,28 @@ namespace Greenshot.Addon.Lutim.ViewModels
/// </summary>
private CompositeDisposable _disposables;
/// <summary>
/// Provide ILutimConfiguration to the view
/// </summary>
public ILutimConfiguration LutimConfiguration { get; set; }
/// <summary>
/// Provide ILutimLanguage to the view
/// </summary>
public ILutimLanguage LutimLanguage { get; set; }
/// <summary>
/// Provide IGreenshotLanguage to the view
/// </summary>
public IGreenshotLanguage GreenshotLanguage { get; set; }
/// <summary>
/// DI constructor
/// </summary>
/// <param name="lutimConfiguration">ILutimConfiguration</param>
/// <param name="lutimLanguage">ILutimLanguage</param>
/// <param name="lutimApi">LutimApi</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
public LutimHistoryViewModel(
ILutimConfiguration lutimConfiguration,
ILutimLanguage lutimLanguage,
@ -64,6 +85,7 @@ namespace Greenshot.Addon.Lutim.ViewModels
/// </summary>
public IList<LutimInfo> LutimHistory { get; } = new BindableCollection<LutimInfo>();
/// <inheritdoc />
protected override void OnActivate()
{
// Prepare disposables
@ -77,6 +99,7 @@ namespace Greenshot.Addon.Lutim.ViewModels
_disposables.Add(lutimHistoryLanguageBinding);
}
/// <inheritdoc />
protected override void OnDeactivate(bool close)
{
_disposables.Dispose();
@ -128,17 +151,33 @@ namespace Greenshot.Addon.Lutim.ViewModels
}
}
/// <summary>
/// The currently selected Lutim entry
/// </summary>
public AddResult SelectedLutim { get; private set; }
/// <summary>
/// Is it possible to delete
/// </summary>
public bool CanDelete => true;
/// <summary>
/// Delete the current selected Lutim
/// </summary>
/// <returns>Task</returns>
public async Task Delete()
{
await _lutimApi.DeleteLutimImage(SelectedLutim);
}
/// <summary>
/// Can the current selected Lutim entry be copied to the clipboard
/// </summary>
public bool CanCopyToClipboard => true;
/// <summary>
/// Copy current selected Lutim entry to the clipboard
/// </summary>
public void CopyToClipboard()
{
// TODO: Build url
@ -149,6 +188,9 @@ namespace Greenshot.Addon.Lutim.ViewModels
}
}
/// <summary>
/// Clear the whole history
/// </summary>
public void ClearHistory()
{
LutimConfiguration.RuntimeLutimHistory.Clear();
@ -156,9 +198,12 @@ namespace Greenshot.Addon.Lutim.ViewModels
LutimHistory.Clear();
}
/// <summary>
/// Show the current selected Lutim entry in the browser
/// </summary>
public void Show()
{
var link = SelectedLutim.LutimInfo.Short;
var link = SelectedLutim?.LutimInfo.Short;
if (link != null)
{
Process.Start(link);

View file

@ -25,10 +25,14 @@ using Greenshot.Addons.Core;
namespace Greenshot.Addon.OneDrive.Configuration
{
/// <summary>
/// The one drive configuration
/// </summary>
[IniSection("OneDrive")]
[Description("Greenshot OneDrive Addon configuration")]
public interface IOneDriveConfiguration : IIniSection, IDestinationFileConfiguration, IOAuth2Token
{
#pragma warning disable 1591
[Description("After upload copy OneDrive link to clipboard.")]
[DefaultValue("true")]
bool AfterUploadLinkToClipBoard { get; set; }

View file

@ -63,6 +63,17 @@ namespace Greenshot.Addon.OneDrive
private readonly HttpBehaviour _oneDriveHttpBehaviour;
/// <summary>
/// DI constructor
/// </summary>
/// <param name="oneDriveConfiguration">IOneDriveConfiguration</param>
/// <param name="oneDriveLanguage">IOneDriveLanguage</param>
/// <param name="httpConfiguration">IHttpConfiguration</param>
/// <param name="resourceProvider">IResourceProvider</param>
/// <param name="pleaseWaitFormFactory">Func</param>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="exportNotification">ExportNotification</param>
public OneDriveDestination(
IOneDriveConfiguration oneDriveConfiguration,
IOneDriveLanguage oneDriveLanguage,
@ -106,8 +117,10 @@ namespace Greenshot.Addon.OneDrive
};
}
/// <inheritdoc />
public override string Description => _oneDriveLanguage.UploadMenuItem;
/// <inheritdoc />
public override IBitmapWithNativeSupport DisplayIcon
{
get
@ -120,6 +133,7 @@ namespace Greenshot.Addon.OneDrive
}
}
/// <inheritdoc />
public override async Task<ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface,
ICaptureDetails captureDetails)
{

View file

@ -19,6 +19,9 @@
namespace Greenshot.Addon.OneDrive
{
/// <summary>
/// Defines the type of link in the one-drive export
/// </summary>
public enum OneDriveLinkType
{
@private,//only user can access

View file

@ -23,6 +23,7 @@ using Dapplo.Config.Ini;
using Dapplo.Config.Ini.Converters;
using Dapplo.HttpExtensions.OAuth;
using Greenshot.Addons.Core;
#pragma warning disable 1591
namespace Greenshot.Addon.Photobucket.Configuration
{

View file

@ -22,9 +22,13 @@ using Dapplo.Config.Language;
namespace Greenshot.Addon.Photobucket.Configuration
{
/// <summary>
/// This contains the translations for the photo bucket add-on
/// </summary>
[Language("Photobucket")]
public interface IPhotobucketLanguage : ILanguage, INotifyPropertyChanged
{
#pragma warning disable 1591
string CommunicationWait { get; }
string Configure { get; }

View file

@ -58,6 +58,16 @@ namespace Greenshot.Addon.Photobucket
private readonly OAuth1HttpBehaviour _oAuthHttpBehaviour;
private IList<string> _albumsCache;
/// <summary>
///
/// </summary>
/// <param name="photobucketConfiguration">IPhotobucketConfiguration</param>
/// <param name="photobucketLanguage">IPhotobucketLanguage</param>
/// <param name="httpConfiguration">IHttpConfiguration</param>
/// <param name="resourceProvider">IResourceProvider</param>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="exportNotification">ExportNotification</param>
public PhotobucketDestination(
IPhotobucketConfiguration photobucketConfiguration,
IPhotobucketLanguage photobucketLanguage,
@ -133,7 +143,18 @@ namespace Greenshot.Addon.Photobucket
_oAuthHttpBehaviour = oAuthHttpBehaviour;
}
protected PhotobucketDestination(
/// <summary>
/// DI constructor
/// </summary>
/// <param name="photobucketConfiguration">IPhotobucketConfiguration</param>
/// <param name="photobucketLanguage">IPhotobucketLanguage</param>
/// <param name="httpConfiguration">IHttpConfiguration</param>
/// <param name="resourceProvider">IResourceProvider</param>
/// <param name="albumPath">string</param>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="exportNotification">ExportNotification</param>
protected PhotobucketDestination(
IPhotobucketConfiguration photobucketConfiguration,
IPhotobucketLanguage photobucketLanguage,
IHttpConfiguration httpConfiguration,
@ -147,7 +168,8 @@ namespace Greenshot.Addon.Photobucket
_albumPath = albumPath;
}
public override string Description
/// <inheritdoc />
public override string Description
{
get
{
@ -159,7 +181,8 @@ namespace Greenshot.Addon.Photobucket
}
}
public override IBitmapWithNativeSupport DisplayIcon
/// <inheritdoc />
public override IBitmapWithNativeSupport DisplayIcon
{
get
{
@ -171,9 +194,11 @@ namespace Greenshot.Addon.Photobucket
}
}
public override bool IsDynamic => true;
/// <inheritdoc />
public override bool IsDynamic => true;
public override IEnumerable<IDestination> DynamicDestinations()
/// <inheritdoc />
public override IEnumerable<IDestination> DynamicDestinations()
{
IList<string> albums = null;
try

View file

@ -24,16 +24,25 @@ using Dapplo.Log;
namespace Greenshot.Addon.Photobucket
{
/// <summary>
/// Description of PhotobucketInfo.
/// Information about a photobucket upload
/// </summary>
public class PhotobucketInfo
{
private static readonly LogSource Log = new LogSource();
/// <summary>
/// Link to the original file
/// </summary>
public string Original { get; set; }
/// <summary>
/// Link to the page
/// </summary>
public string Page { get; set; }
/// <summary>
/// Link to the thumbnail
/// </summary>
public string Thumbnail { get; set; }
/// <summary>

View file

@ -27,6 +27,9 @@ using Greenshot.Addons.ViewModels;
namespace Greenshot.Addon.Photobucket.ViewModels
{
/// <summary>
/// This is the view model for the photobucket config
/// </summary>
public sealed class PhotobucketConfigViewModel : SimpleConfigScreen
{
/// <summary>
@ -34,11 +37,30 @@ namespace Greenshot.Addon.Photobucket.ViewModels
/// </summary>
private CompositeDisposable _disposables;
/// <summary>
/// Provide the IPhotobucketConfiguration to the view
/// </summary>
public IPhotobucketConfiguration PhotobucketConfiguration { get; }
/// <summary>
/// Provide the IPhotobucketLanguage to the view
/// </summary>
public IPhotobucketLanguage PhotobucketLanguage { get; }
/// <summary>
/// Provide the IGreenshotLanguage to the view
/// </summary>
public IGreenshotLanguage GreenshotLanguage { get; }
/// <summary>
/// Provide the FileConfigPartViewModel to the view
/// </summary>
public FileConfigPartViewModel FileConfigPartViewModel { get; }
/// <summary>
/// DI constructor
/// </summary>
/// <param name="photobucketConfiguration">IPhotobucketConfiguration</param>
/// <param name="photobucketLanguage">IPhotobucketLanguage</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="fileConfigPartViewModel">FileConfigPartViewModel</param>
public PhotobucketConfigViewModel(
IPhotobucketConfiguration photobucketConfiguration,
IPhotobucketLanguage photobucketLanguage,
@ -51,6 +73,7 @@ namespace Greenshot.Addon.Photobucket.ViewModels
FileConfigPartViewModel = fileConfigPartViewModel;
}
/// <inheritdoc />
public override void Initialize(IConfig config)
{
FileConfigPartViewModel.DestinationFileConfiguration = PhotobucketConfiguration;
@ -72,6 +95,7 @@ namespace Greenshot.Addon.Photobucket.ViewModels
base.Initialize(config);
}
/// <inheritdoc />
protected override void OnDeactivate(bool close)
{
_disposables.Dispose();

View file

@ -23,8 +23,13 @@ using Dapplo.Config.Ini;
using Dapplo.Config.Ini.Converters;
using Greenshot.Addons.Core;
#pragma warning disable 1591
namespace Greenshot.Addon.Tfs.Configuration
{
/// <summary>
/// This contains the TFS add-on configuration
/// </summary>
[IniSection("Tfs")]
[Description("Greenshot Tfs Addon configuration")]
public interface ITfsConfiguration : IIniSection, IDestinationFileConfiguration

View file

@ -17,13 +17,16 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.ComponentModel;
using Dapplo.Config.Language;
namespace Greenshot.Addon.Tfs
namespace Greenshot.Addon.Tfs.Configuration
{
/// <summary>
/// This contains the translations which are available for the TFS add-on
/// </summary>
[Language("Tfs")]
public interface ITfsLanguage : ILanguage, INotifyPropertyChanged
#pragma warning disable 1591
public interface ITfsLanguage : ILanguage
{
string CommunicationWait { get; }

View file

@ -21,9 +21,15 @@ using Newtonsoft.Json;
namespace Greenshot.Addon.Tfs.Entities
{
/// <summary>
/// This is the attribute entity for the TFS communication
/// </summary>
[JsonObject]
public class Attributes
{
/// <summary>
/// A comment in the attribute
/// </summary>
[JsonProperty("comment")]
public string Comment { get; set; }
}

View file

@ -28,9 +28,15 @@ namespace Greenshot.Addon.Tfs.Entities
[JsonObject]
public class CreateAttachmentResult
{
/// <summary>
/// The ID of the attachment
/// </summary>
[JsonProperty("id")]
public string id { get; set; }
public string Id { get; set; }
/// <summary>
/// The URL where the attachment can be found
/// </summary>
[JsonProperty("url")]
public Uri Url { get; set; }
}

View file

@ -27,11 +27,21 @@ namespace Greenshot.Addon.Tfs.Entities
[JsonObject]
public class Operation
{
/// <summary>
/// Type of the operation
/// </summary>
[JsonProperty("op")]
public string OperationType { get; set; }
/// <summary>
/// Path of the operation
/// </summary>
[JsonProperty("path")]
public string Path { get; set; }
/// <summary>
/// Value for the operation
/// </summary>
[JsonProperty("value")]
public Value Value { get; set; }
}

View file

@ -22,15 +22,27 @@ using Newtonsoft.Json;
namespace Greenshot.Addon.Tfs.Entities
{
/// <summary>
/// Describes a value
/// </summary>
[JsonObject]
public class Value
{
/// <summary>
/// The relation
/// </summary>
[JsonProperty("rel")]
public string Relation { get; set; }
/// <summary>
/// The URL
/// </summary>
[JsonProperty("url")]
public Uri Url { get; set; }
/// <summary>
/// The attributes
/// </summary>
[JsonProperty("attributes")]
public Attributes Attributes { get; set; }
}

View file

@ -21,15 +21,27 @@ using Newtonsoft.Json;
namespace Greenshot.Addon.Tfs.Entities
{
/// <summary>
/// Work item fields
/// </summary>
[JsonObject]
public class WorkItemFields
{
/// <summary>
/// Title of the work item
/// </summary>
[JsonProperty("System.Title")]
public string Title { get; set; }
/// <summary>
/// Type for the work item
/// </summary>
[JsonProperty("System.WorkItemType")]
public string WorkItemType { get; set; }
/// <summary>
/// State of the work item
/// </summary>
[JsonProperty("System.State")]
public string State { get; set; }
}

View file

@ -22,11 +22,21 @@ using Newtonsoft.Json;
namespace Greenshot.Addon.Tfs.Entities
{
/// <summary>
/// A list of work items
/// </summary>
[JsonObject]
public class WorkItemList
{
/// <summary>
/// The count for this list
/// </summary>
[JsonProperty("count")]
public int Count { get; set; }
/// <summary>
/// The items
/// </summary>
[JsonProperty("value")]
public IList<WorkItem> Items { get; set; }
}

View file

@ -22,9 +22,15 @@ using Newtonsoft.Json;
namespace Greenshot.Addon.Tfs.Entities
{
/// <summary>
/// The result of a query
/// </summary>
[JsonObject]
public class WorkItemQueryResult
{
/// <summary>
/// The work items
/// </summary>
[JsonProperty("workItems")]
public IList<WorkItem> Items { get; set; }
}

View file

@ -22,18 +22,33 @@ using Newtonsoft.Json;
namespace Greenshot.Addon.Tfs.Entities
{
/// <summary>
/// The workitem entity
/// </summary>
[JsonObject]
public class WorkItem
{
/// <summary>
/// ID of the workitem
/// </summary>
[JsonProperty("id")]
public long Id { get; set; }
/// <summary>
/// The revision of the workitem
/// </summary>
[JsonProperty("rev")]
public int Reversion { get; set; }
public int Revision { get; set; }
/// <summary>
/// The URL of the workitem
/// </summary>
[JsonProperty("url")]
public Uri Url { get; set; }
/// <summary>
/// The fields of the workitem
/// </summary>
[JsonProperty("fields")]
public WorkItemFields Fields { get; set; }
}

View file

@ -32,6 +32,7 @@ namespace Greenshot.Addon.Tfs
/// <inheritdoc />
public class TfsAddonModule : AddonModule
{
/// <inheritdoc />
protected override void Load(ContainerBuilder builder)
{
builder

View file

@ -37,7 +37,7 @@ using Newtonsoft.Json.Linq;
namespace Greenshot.Addon.Tfs
{
/// <summary>
/// This capsulates the TFS api calls
/// This encapsulates the TFS api calls
/// </summary>
public class TfsClient
{
@ -45,6 +45,12 @@ namespace Greenshot.Addon.Tfs
private readonly ITfsConfiguration _tfsConfiguration;
private readonly HttpBehaviour _tfsHttpBehaviour;
/// <summary>
/// DI constructor
/// </summary>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="tfsConfiguration">ITfsConfiguration</param>
/// <param name="httpConfiguration">IHttpConfiguration</param>
public TfsClient(
ICoreConfiguration coreConfiguration,
ITfsConfiguration tfsConfiguration,
@ -69,9 +75,20 @@ namespace Greenshot.Addon.Tfs
}
/// <summary>
/// Is it possible to update?
/// </summary>
public bool CanUpdate => _tfsConfiguration.TfsUri != null && !string.IsNullOrEmpty(_tfsConfiguration.ApiKey);
/// <summary>
/// The work items for this client
/// </summary>
public IDictionary<long, WorkItem> WorkItems { get; } = new Dictionary<long, WorkItem>();
/// <summary>
/// Request a work item update
/// </summary>
/// <returns></returns>
public async Task UpdateWorkItems()
{
if (!CanUpdate)
@ -85,7 +102,7 @@ namespace Greenshot.Addon.Tfs
}
}
/// <summary>
/// Retrieve the own workitems
/// Retrieve the own work items
/// </summary>
/// <returns>WorkItemList</returns>
public async Task<WorkItemList> GetOwnWorkitems()

View file

@ -40,7 +40,7 @@ using Greenshot.Gfx;
namespace Greenshot.Addon.Tfs
{
/// <summary>
/// Description of OneDriveDestination.
/// This is the TFS destination
/// </summary>
[Destination("Tfs")]
public class TfsDestination : AbstractDestination
@ -54,6 +54,17 @@ namespace Greenshot.Addon.Tfs
private readonly ExportNotification _exportNotification;
private readonly WorkItem _workItem;
/// <summary>
/// DI constructor
/// </summary>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="tfsConfiguration">ITfsConfiguration</param>
/// <param name="tfsLanguage">ITfsLanguage</param>
/// <param name="tfsClient">TfsClient</param>
/// <param name="pleaseWaitFormFactory">Func to create please wait forms</param>
/// <param name="resourceProvider">IResourceProvider</param>
/// <param name="exportNotification">ExportNotification</param>
public TfsDestination(
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage,
@ -72,6 +83,18 @@ namespace Greenshot.Addon.Tfs
_exportNotification = exportNotification;
}
/// <summary>
/// DI constructor
/// </summary>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="tfsConfiguration">ITfsConfiguration</param>
/// <param name="tfsLanguage">ITfsLanguage</param>
/// <param name="tfsClient">TfsClient</param>
/// <param name="pleaseWaitFormFactory">Func to create please wait forms</param>
/// <param name="resourceProvider">IResourceProvider</param>
/// <param name="exportNotification">ExportNotification</param>
/// <param name="workItem">WorkItem which is exported to</param>
protected TfsDestination(
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage,
@ -86,12 +109,16 @@ namespace Greenshot.Addon.Tfs
_workItem = workItem;
}
/// <inheritdoc />
public override bool IsActive => base.IsActive && _tfsClient.CanUpdate;
/// <inheritdoc />
public override bool UseDynamicsOnly => true;
/// <inheritdoc />
public override bool IsDynamic => true;
/// <inheritdoc />
protected override async Task PrepareDynamicDestinations(ToolStripMenuItem destinationToolStripMenuItem)
{
if (!destinationToolStripMenuItem.HasDropDownItems)
@ -103,19 +130,21 @@ namespace Greenshot.Addon.Tfs
}
}
/// <inheritdoc />
public override IEnumerable<IDestination> DynamicDestinations()
{
var workitems = _tfsClient.WorkItems.Values;
if (workitems.Count == 0)
var workItems = _tfsClient.WorkItems.Values;
if (workItems.Count == 0)
{
yield break;
}
foreach (var workitem in workitems)
foreach (var workItem in workItems)
{
yield return new TfsDestination(CoreConfiguration, GreenshotLanguage, _tfsConfiguration, _tfsLanguage, _tfsClient, _pleaseWaitFormFactory, _resourceProvider, _exportNotification, workitem);
yield return new TfsDestination(CoreConfiguration, GreenshotLanguage, _tfsConfiguration, _tfsLanguage, _tfsClient, _pleaseWaitFormFactory, _resourceProvider, _exportNotification, workItem);
}
}
/// <inheritdoc />
public override string Description
{
get
@ -130,6 +159,7 @@ namespace Greenshot.Addon.Tfs
}
}
/// <inheritdoc />
public override IBitmapWithNativeSupport DisplayIcon
{
get
@ -142,6 +172,7 @@ namespace Greenshot.Addon.Tfs
}
}
/// <inheritdoc />
public override async Task<ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
{
if (_workItem == null)

View file

@ -27,6 +27,9 @@ using Greenshot.Addons.ViewModels;
namespace Greenshot.Addon.Tfs.ViewModels
{
/// <summary>
/// This is the view model for the TFS add-on configuration
/// </summary>
public sealed class TfsConfigViewModel : SimpleConfigScreen
{
/// <summary>
@ -34,16 +37,36 @@ namespace Greenshot.Addon.Tfs.ViewModels
/// </summary>
private CompositeDisposable _disposables;
/// <summary>
/// Supply the ITfsConfiguration to the view
/// </summary>
public ITfsConfiguration TfsConfiguration { get; }
/// <summary>
/// Supply the ITfsLanguage (translations) to the view
/// </summary>
public ITfsLanguage TfsLanguage { get; }
/// <summary>
/// Supply the IGreenshotLanguage (translations) to the view
/// </summary>
public IGreenshotLanguage GreenshotLanguage { get; }
public TfsClient TfsClient { get; }
private TfsClient TfsClient { get; }
/// <summary>
/// Supply the FileConfigPartViewModel to the view, which is used as a component
/// </summary>
public FileConfigPartViewModel FileConfigPartViewModel { get; }
/// <summary>
/// DI constructor
/// </summary>
/// <param name="tfsConfiguration">ITfsConfiguration</param>
/// <param name="tfsLanguage">ITfsLanguage</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="tfsClient">TfsClient</param>
/// <param name="fileConfigPartViewModel">FileConfigPartViewModel</param>
public TfsConfigViewModel(
ITfsConfiguration tfsConfiguration,
ITfsLanguage tfsLanguage,
@ -57,6 +80,8 @@ namespace Greenshot.Addon.Tfs.ViewModels
TfsClient = tfsClient;
FileConfigPartViewModel = fileConfigPartViewModel;
}
/// <inheritdoc />
public override void Initialize(IConfig config)
{
FileConfigPartViewModel.DestinationFileConfiguration = TfsConfiguration;
@ -77,6 +102,7 @@ namespace Greenshot.Addon.Tfs.ViewModels
base.Initialize(config);
}
/// <inheritdoc />
protected override void OnDeactivate(bool close)
{
var ignoreTask = TfsClient.UpdateWorkItems();

View file

@ -1,4 +1,23 @@
using System;
// Greenshot - a free and open source screenshot tool
// Copyright (C) 2007-2019 Thomas Braun, Jens Klingen, Robin Krom
//
// For more information see: http://getgreenshot.org/
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using System.Linq;
@ -12,8 +31,16 @@ namespace Greenshot.Addons.Components
private readonly IEnumerable<Lazy<IDestination, DestinationAttribute>> _destinations;
private readonly IEnumerable<IDestinationProvider> _destinationProviders;
/// <summary>
/// This is the Instance of the DestinationHolder, used for some cases where DI doesn't work
/// </summary>
public static DestinationHolder Instance { get; internal set; }
/// <summary>
/// DI constructor
/// </summary>
/// <param name="destinations">IEnumerable with lazy IDestination</param>
/// <param name="destinationProviders">IEnumerable with IDestinationProvider</param>
public DestinationHolder(
IEnumerable<Lazy<IDestination, DestinationAttribute>> destinations,
IEnumerable<IDestinationProvider> destinationProviders

View file

@ -39,7 +39,7 @@ namespace Greenshot.Addons.Components
private readonly Func<IDestination, ExportInformation, ISurface, IConfigScreen, Owned<ExportNotificationViewModel>> _toastFactory;
/// <summary>
/// DI Constructor
/// DI constructor
/// </summary>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="eventAggregator">IEventAggregator</param>

View file

@ -32,6 +32,10 @@ namespace Greenshot.Addons.Controls
{
private readonly ICoreConfiguration _coreConfiguration;
/// <summary>
/// DI constructor
/// </summary>
/// <param name="coreConfiguration"></param>
public ContextMenuToolStripProfessionalRenderer(ICoreConfiguration coreConfiguration)
{
_coreConfiguration = coreConfiguration;
@ -39,7 +43,9 @@ namespace Greenshot.Addons.Controls
private IBitmapWithNativeSupport _scaledCheckbox;
private bool _newImage;
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
/// <inheritdoc />
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
if (_scaledCheckbox == null || (NativeSize)_scaledCheckbox.Size != _coreConfiguration.IconSize)
{

View file

@ -34,23 +34,33 @@ namespace Greenshot.Addons.Controls
private Type _enumType;
private Enum _selectedEnum;
/// <summary>
/// Default constructor
/// </summary>
/// <param name="language"></param>
public GreenshotComboBox(ILanguage language)
{
_language = language;
SelectedIndexChanged += (sender, args) => StoreSelectedEnum();
}
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue("Core")]
[Description("Specifies the Ini-Section to map this control with.")]
public string SectionName { get; set; } = "Core";
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue(null)]
[Description("Specifies the property name to map the configuration.")]
public string PropertyName { get; set; }
public void SetValue(Enum currentValue)
/// <summary>
/// Set the value
/// </summary>
/// <param name="currentValue">Enum</param>
public void SetValue(Enum currentValue)
{
if (currentValue == null)
{
@ -71,7 +81,7 @@ namespace Greenshot.Addons.Controls
}
/// <summary>
/// This is a method to popululate the ComboBox
/// This is a method to populate the ComboBox
/// with the items from the enumeration
/// </summary>
/// <param name="enumType">TEnum to populate with</param>

View file

@ -22,9 +22,13 @@ using System.Windows.Forms;
namespace Greenshot.Addons.Controls
{
public class GreenshotLabel : Label, IGreenshotLanguageBindable
/// <summary>
/// This is a System.Windows.Forms which has a language key for the translation
/// </summary>
public class GreenshotLabel : Label, IGreenshotLanguageBindable
{
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue(null)]
[Description("Specifies key of the language file to use when displaying the text.")]
public string LanguageKey { get; set; }

View file

@ -22,22 +22,25 @@ using System.Windows.Forms;
namespace Greenshot.Addons.Controls
{
/// <summary>
/// Description of GreenshotCheckbox.
/// </summary>
public class GreenshotRadioButton : RadioButton, IGreenshotLanguageBindable, IGreenshotConfigBindable
/// <summary>
/// GreenshotRadioButton allow to work on a configuration and have translations
/// </summary>
public class GreenshotRadioButton : RadioButton, IGreenshotLanguageBindable, IGreenshotConfigBindable
{
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue("Core")]
[Description("Specifies the Ini-Section to map this control with.")]
public string SectionName { get; set; } = "Core";
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue(null)]
[Description("Specifies the property name to map the configuration.")]
public string PropertyName { get; set; }
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue(null)]
[Description("Specifies key of the language file to use when displaying the text.")]
public string LanguageKey { get; set; }

View file

@ -22,14 +22,19 @@ using System.Windows.Forms;
namespace Greenshot.Addons.Controls
{
/// <summary>
/// A text box which reads / writes to the configuration
/// </summary>
public class GreenshotTextBox : TextBox, IGreenshotConfigBindable
{
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue("Core")]
[Description("Specifies the Ini-Section to map this control with.")]
public string SectionName { get; set; } = "Core";
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue(null)]
[Description("Specifies the property name to map the configuration.")]
public string PropertyName { get; set; }

View file

@ -22,9 +22,13 @@ using System.Windows.Forms;
namespace Greenshot.Addons.Controls
{
/// <summary>
/// This is a tool-strip dropdown button which has a translation
/// </summary>
public class GreenshotToolStripDropDownButton : ToolStripDropDownButton, IGreenshotLanguageBindable
{
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue(null)]
[Description("Specifies key of the language file to use when displaying the text.")]
public string LanguageKey { get; set; }

View file

@ -22,9 +22,13 @@ using System.Windows.Forms;
namespace Greenshot.Addons.Controls
{
/// <summary>
/// This is a tool-strip button with translations
/// </summary>
public class GreenshotToolStripButton : ToolStripButton, IGreenshotLanguageBindable
{
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue(null)]
[Description("Specifies key of the language file to use when displaying the text.")]
public string LanguageKey { get; set; }

View file

@ -22,9 +22,13 @@ using System.Windows.Forms;
namespace Greenshot.Addons.Controls
{
/// <summary>
/// this is a tool-strip label with translations
/// </summary>
public class GreenshotToolStripLabel : ToolStripLabel, IGreenshotLanguageBindable
{
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue(null)]
[Description("Specifies key of the language file to use when displaying the text.")]
public string LanguageKey { get; set; }

View file

@ -22,9 +22,13 @@ using System.Windows.Forms;
namespace Greenshot.Addons.Controls
{
/// <summary>
/// This is a tool-strip menu item with translations
/// </summary>
public class GreenshotToolStripMenuItem : ToolStripMenuItem, IGreenshotLanguageBindable
{
[Category("Greenshot")]
/// <inheritdoc />
[Category("Greenshot")]
[DefaultValue(null)]
[Description("Specifies key of the language file to use when displaying the text.")]
public string LanguageKey { get; set; }

View file

@ -37,14 +37,36 @@ namespace Greenshot.Addons.Controls
/// </summary>
public sealed class HotkeyControl : GreenshotTextBox
{
/// <summary>
/// Modifiers are the additional keys which are pressed together with the "key", like ctrl or shift.
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[Flags]
public enum Modifiers : uint
{
/// <summary>
/// no modifier is pressed
/// </summary>
NONE = 0,
/// <summary>
/// The alt key is pressed
/// </summary>
ALT = 1,
/// <summary>
/// The ctrl key is pressed
/// </summary>
CTRL = 2,
/// <summary>
/// The shift key is pressed
/// </summary>
SHIFT = 4,
/// <summary>
/// The win key is pressed
/// </summary>
WIN = 8,
/// <summary>
/// When registering hotkeys, this can be specified to prevent repeating keys
/// </summary>
NO_REPEAT = 0x4000
}
@ -364,11 +386,17 @@ namespace Greenshot.Addons.Controls
Text = HotkeyToLocalizedString(_modifiers, _hotkey);
}
public override string ToString()
/// <inheritdoc />
public override string ToString()
{
return HotkeyToString(HotkeyModifiers, Hotkey);
}
/// <summary>
/// Get a localized version, for displaying, of a hotkey string
/// </summary>
/// <param name="hotkeyString"></param>
/// <returns></returns>
public static string GetLocalizedHotkeyStringFromString(string hotkeyString)
{
var virtualKeyCode = HotkeyFromString(hotkeyString);
@ -376,12 +404,23 @@ namespace Greenshot.Addons.Controls
return HotkeyToLocalizedString(modifiers, virtualKeyCode);
}
public static string HotkeyToString(Keys modifierKeyCode, Keys virtualKeyCode)
/// <summary>
/// Create a string representation from a hotkey
/// </summary>
/// <param name="modifierKeyCode">Keys</param>
/// <param name="virtualKeyCode">Keys</param>
/// <returns>string</returns>
public static string HotkeyToString(Keys modifierKeyCode, Keys virtualKeyCode)
{
return HotkeyModifiersToString(modifierKeyCode) + virtualKeyCode;
}
public static string HotkeyModifiersToString(Keys modifierKeyCode)
/// <summary>
/// Create a string representation from modifiers
/// </summary>
/// <param name="modifierKeyCode">Keys</param>
/// <returns>string</returns>
public static string HotkeyModifiersToString(Keys modifierKeyCode)
{
var hotkeyString = new StringBuilder();
if ((modifierKeyCode & Keys.Alt) > 0)
@ -404,12 +443,23 @@ namespace Greenshot.Addons.Controls
}
public static string HotkeyToLocalizedString(Keys modifierKeyCode, Keys virtualKeyCode)
/// <summary>
/// Get a localized version, for displaying, of a hotkey
/// </summary>
/// <param name="modifierKeyCode">Keys</param>
/// <param name="virtualKeyCode">Keys</param>
/// <returns>string</returns>
public static string HotkeyToLocalizedString(Keys modifierKeyCode, Keys virtualKeyCode)
{
return HotkeyModifiersToLocalizedString(modifierKeyCode) + GetKeyName(virtualKeyCode);
}
public static string HotkeyModifiersToLocalizedString(Keys modifierKeyCode)
/// <summary>
/// Get a localized version, for displaying, of modifiers
/// </summary>
/// <param name="modifierKeyCode">Keys</param>
/// <returns>string</returns>
public static string HotkeyModifiersToLocalizedString(Keys modifierKeyCode)
{
var hotkeyString = new StringBuilder();
if ((modifierKeyCode & Keys.Alt) > 0)
@ -431,8 +481,12 @@ namespace Greenshot.Addons.Controls
return hotkeyString.ToString();
}
public static Keys HotkeyModifiersFromString(string modifiersString)
/// <summary>
/// Create modifiers from a string
/// </summary>
/// <param name="modifiersString">string</param>
/// <returns>Keys</returns>
public static Keys HotkeyModifiersFromString(string modifiersString)
{
var modifiers = Keys.None;
if (!string.IsNullOrEmpty(modifiersString))
@ -457,7 +511,12 @@ namespace Greenshot.Addons.Controls
return modifiers;
}
public static Keys HotkeyFromString(string hotkey)
/// <summary>
/// Create hotkey from a string
/// </summary>
/// <param name="hotkey">string</param>
/// <returns>Keys</returns>
public static Keys HotkeyFromString(string hotkey)
{
var key = Keys.None;
if (!string.IsNullOrEmpty(hotkey))
@ -471,16 +530,6 @@ namespace Greenshot.Addons.Controls
return key;
}
public static void RegisterHotkeyHwnd(IntPtr hWnd)
{
_hotkeyHwnd = hWnd;
}
public static int RegisterHotKey(string hotkey, HotKeyHandler handler)
{
return RegisterHotKey(HotkeyModifiersFromString(hotkey), HotkeyFromString(hotkey), handler);
}
/// <summary>
/// Register a hotkey
/// </summary>
@ -527,34 +576,6 @@ namespace Greenshot.Addons.Controls
return -1;
}
public static void UnregisterHotkeys()
{
foreach (var hotkey in KeyHandlers.Keys)
{
UnregisterHotKey(_hotkeyHwnd, hotkey);
}
// Remove all key handlers
KeyHandlers.Clear();
}
public static void UnregisterHotkey(int hotkey)
{
var removeHotkey = false;
foreach (var availableHotkey in KeyHandlers.Keys)
{
if (availableHotkey == hotkey)
{
UnregisterHotKey(_hotkeyHwnd, hotkey);
removeHotkey = true;
}
}
if (removeHotkey)
{
// Remove key handler
KeyHandlers.Remove(hotkey);
}
}
/// <summary>
/// Handle WndProc messages for the hotkey
/// </summary>
@ -579,7 +600,12 @@ namespace Greenshot.Addons.Controls
return true;
}
public static string GetKeyName(Keys givenKey)
/// <summary>
/// Get the key name
/// </summary>
/// <param name="givenKey">Keys</param>
/// <returns>string</returns>
public static string GetKeyName(Keys givenKey)
{
var keyName = new StringBuilder();
const uint numpad = 55;

View file

@ -19,6 +19,9 @@
namespace Greenshot.Addons.Controls
{
/// <summary>
/// Specifies that a control can be bound to a configuration value
/// </summary>
public interface IGreenshotConfigBindable
{
/// <summary>

View file

@ -23,14 +23,18 @@ using System.Windows.Data;
namespace Greenshot.Addons.Controls
{
/// <summary>
/// This is a boolean converter for WPF which allows to invert the value (true -> false and false -> true)
/// </summary>
public class InvertedBooleanConverter : IValueConverter
{
/// <inheritdoc />
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return !(bool)(value ?? false);
}
/// <inheritdoc />
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return !(bool)(value ?? false);

View file

@ -31,11 +31,17 @@ namespace Greenshot.Addons.Controls
/// </summary>
public partial class MovableShowColorForm : Form
{
/// <summary>
/// Default constructor for a control
/// </summary>
public MovableShowColorForm()
{
InitializeComponent();
}
/// <summary>
/// The color under the cursor
/// </summary>
public Color ColorUnderCursor => preview.BackColor;
/// <summary>

View file

@ -43,7 +43,7 @@ namespace Greenshot.Addons.Controls
private Thread _waitFor;
/// <summary>
/// DI Constructor
/// DI constructor
/// </summary>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
public PleaseWaitForm(IGreenshotLanguage greenshotLanguage)
@ -57,7 +57,7 @@ namespace Greenshot.Addons.Controls
}
/// <summary>
/// DI Constructor
/// DI constructor
/// </summary>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
/// <param name="cancellationTokenSource">CancellationTokenSource</param>

View file

@ -25,13 +25,19 @@ using Greenshot.Core.Enums;
namespace Greenshot.Addons.Controls
{
/// <summary>
/// Description of JpegQualityDialog.
/// This is a dialog where the user can specify the quality of the written bitmap
/// </summary>
public partial class QualityDialog : GreenshotForm
{
private readonly ICoreConfiguration _coreConfiguration;
public QualityDialog(
/// <summary>
/// DI constructor
/// </summary>
/// <param name="outputSettings">SurfaceOutputSettings</param>
/// <param name="coreConfiguration">ICoreConfiguration</param>
/// <param name="greenshotLanguage">IGreenshotLanguage</param>
public QualityDialog(
SurfaceOutputSettings outputSettings,
ICoreConfiguration coreConfiguration,
IGreenshotLanguage greenshotLanguage) : base(greenshotLanguage)
@ -51,7 +57,10 @@ namespace Greenshot.Addons.Controls
ToFront = true;
}
public SurfaceOutputSettings Settings { get; set; }
/// <summary>
/// This SurfaceOutputSettings which result from this form
/// </summary>
public SurfaceOutputSettings Settings { get; set; }
private void Button_okClick(object sender, EventArgs e)
{

Some files were not shown because too many files have changed in this diff Show more