diff --git a/src/Greenshot.Addon.Box/BoxAddonModule.cs b/src/Greenshot.Addon.Box/BoxAddonModule.cs index ca32029ae..1fcdacb62 100644 --- a/src/Greenshot.Addon.Box/BoxAddonModule.cs +++ b/src/Greenshot.Addon.Box/BoxAddonModule.cs @@ -32,6 +32,7 @@ namespace Greenshot.Addon.Box /// public class BoxAddonModule : AddonModule { + /// protected override void Load(ContainerBuilder builder) { builder diff --git a/src/Greenshot.Addon.Box/BoxDestination.cs b/src/Greenshot.Addon.Box/BoxDestination.cs index 7fc8f2b44..b9a0ed8e4 100644 --- a/src/Greenshot.Addon.Box/BoxDestination.cs +++ b/src/Greenshot.Addon.Box/BoxDestination.cs @@ -44,6 +44,9 @@ using Greenshot.Gfx; namespace Greenshot.Addon.Box { + /// + /// This is the destination for the Box service + /// [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( + /// + /// DI constructor + /// + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification + /// IBoxConfiguration + /// IBoxLanguage + /// Func factory for PleaseWaitForm + /// IHttpConfiguration + /// IResourceProvider + public BoxDestination( ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, ExportNotification exportNotification, @@ -96,9 +110,11 @@ namespace Greenshot.Addon.Box }; } - public override string Description => _boxLanguage.UploadMenuItem; + /// + public override string Description => _boxLanguage.UploadMenuItem; - public override IBitmapWithNativeSupport DisplayIcon + /// + public override IBitmapWithNativeSupport DisplayIcon { get { @@ -110,7 +126,8 @@ namespace Greenshot.Addon.Box } } - public override async Task ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) + /// + public override async Task ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); var uploadUrl = await UploadAsync(surface).ConfigureAwait(true); diff --git a/src/Greenshot.Addon.Box/Configuration/IBoxLanguage.cs b/src/Greenshot.Addon.Box/Configuration/IBoxLanguage.cs index 51aa2561e..cd63902fd 100644 --- a/src/Greenshot.Addon.Box/Configuration/IBoxLanguage.cs +++ b/src/Greenshot.Addon.Box/Configuration/IBoxLanguage.cs @@ -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; } diff --git a/src/Greenshot.Addon.Box/Configuration/Impl/BoxConfigurationImpl.cs b/src/Greenshot.Addon.Box/Configuration/Impl/BoxConfigurationImpl.cs index c6e8f15ed..8d871a78b 100644 --- a/src/Greenshot.Addon.Box/Configuration/Impl/BoxConfigurationImpl.cs +++ b/src/Greenshot.Addon.Box/Configuration/Impl/BoxConfigurationImpl.cs @@ -27,6 +27,7 @@ namespace Greenshot.Addon.Box.Configuration.Impl { internal class BoxConfigurationImpl : IniSectionBase, IBoxConfiguration { +#pragma warning disable 1591 public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } diff --git a/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs b/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs index 7abd2ec9d..8ac9de65f 100644 --- a/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs +++ b/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs @@ -27,8 +27,9 @@ namespace Greenshot.Addon.Box.Configuration.Impl /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] #pragma warning disable CS1591 - public class BoxLanguageImpl : LanguageBase, IBoxLanguage + internal class BoxLanguageImpl : LanguageBase, IBoxLanguage { +#pragma warning disable 1591 public string CommunicationWait { get; } public string Configure { get; } public string LabelAfterUpload { get; } diff --git a/src/Greenshot.Addon.Confluence/Configuration/IConfluenceConfiguration.cs b/src/Greenshot.Addon.Confluence/Configuration/IConfluenceConfiguration.cs index a8afb6329..c42df59d3 100644 --- a/src/Greenshot.Addon.Confluence/Configuration/IConfluenceConfiguration.cs +++ b/src/Greenshot.Addon.Confluence/Configuration/IConfluenceConfiguration.cs @@ -24,13 +24,14 @@ using Greenshot.Core.Enums; namespace Greenshot.Addon.Confluence.Configuration { /// - /// Description of ConfluenceConfiguration. + /// The configuration for the confluence add-on /// [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; } diff --git a/src/Greenshot.Addon.Confluence/Configuration/IConfluenceLanguage.cs b/src/Greenshot.Addon.Confluence/Configuration/IConfluenceLanguage.cs index 589aa9812..8d161f084 100644 --- a/src/Greenshot.Addon.Confluence/Configuration/IConfluenceLanguage.cs +++ b/src/Greenshot.Addon.Confluence/Configuration/IConfluenceLanguage.cs @@ -21,9 +21,13 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Confluence.Configuration { + /// + /// The translations for the Confluence add-on + /// [Language("Confluence")] public interface IConfluenceLanguage : ILanguage { +#pragma warning disable 1591 string PluginSettings { get; } string LoginError { get; } string LabelUrl { get; } diff --git a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceConfigurationImpl.cs b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceConfigurationImpl.cs index 1e4b580d5..026df3262 100644 --- a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceConfigurationImpl.cs +++ b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceConfigurationImpl.cs @@ -24,6 +24,7 @@ namespace Greenshot.Addon.Confluence.Configuration.Impl { internal class ConfluenceConfigurationImpl : IniSectionBase, IConfluenceConfiguration { +#pragma warning disable 1591 public string Url { get; set; } public int Timeout { get; set; } public OutputFormats UploadFormat { get; set; } diff --git a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs index 10bda771e..53743106e 100644 --- a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs +++ b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs @@ -27,8 +27,9 @@ namespace Greenshot.Addon.Confluence.Configuration.Impl /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] #pragma warning disable CS1591 - public class ConfluenceLanguageImpl : LanguageBase, IConfluenceLanguage + internal class ConfluenceLanguageImpl : LanguageBase, IConfluenceLanguage { +#pragma warning disable 1591 public string PluginSettings { get; } public string LoginError { get; } public string LabelUrl { get; } diff --git a/src/Greenshot.Addon.Confluence/ConfluenceDestination.cs b/src/Greenshot.Addon.Confluence/ConfluenceDestination.cs index b5db8e1f5..36dcde8c3 100644 --- a/src/Greenshot.Addon.Confluence/ConfluenceDestination.cs +++ b/src/Greenshot.Addon.Confluence/ConfluenceDestination.cs @@ -98,9 +98,13 @@ namespace Greenshot.Addon.Confluence _page = page; } + /// + /// Is the destination initialized? + /// public static bool IsInitialized { get; private set; } - public override string Description + /// + public override string Description { get { @@ -112,9 +116,11 @@ namespace Greenshot.Addon.Confluence } } - public override bool IsDynamic => true; + /// + public override bool IsDynamic => true; - public override bool IsActive => base.IsActive && !string.IsNullOrEmpty(_confluenceConfiguration.Url); + /// + 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) + /// + 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 diff --git a/src/Greenshot.Addon.Confluence/ViewModels/ConfluenceConfigViewModel.cs b/src/Greenshot.Addon.Confluence/ViewModels/ConfluenceConfigViewModel.cs index bf8794767..8946be243 100644 --- a/src/Greenshot.Addon.Confluence/ViewModels/ConfluenceConfigViewModel.cs +++ b/src/Greenshot.Addon.Confluence/ViewModels/ConfluenceConfigViewModel.cs @@ -29,6 +29,9 @@ using Greenshot.Core.Enums; namespace Greenshot.Addon.Confluence.ViewModels { + /// + /// View model for the confluence configuration + /// public sealed class ConfluenceConfigViewModel : SimpleConfigScreen { /// @@ -50,6 +53,7 @@ namespace Greenshot.Addon.Confluence.ViewModels GreenshotLanguage = greenshotLanguage; } + /// public override void Initialize(IConfig config) { // Prepare disposables @@ -69,6 +73,7 @@ namespace Greenshot.Addon.Confluence.ViewModels base.Initialize(config); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); diff --git a/src/Greenshot.Addon.Dropbox/Configuration/IDropboxLanguage.cs b/src/Greenshot.Addon.Dropbox/Configuration/IDropboxLanguage.cs index c160b1174..be778d94f 100644 --- a/src/Greenshot.Addon.Dropbox/Configuration/IDropboxLanguage.cs +++ b/src/Greenshot.Addon.Dropbox/Configuration/IDropboxLanguage.cs @@ -21,10 +21,14 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Dropbox.Configuration { + /// + /// Translations for the dropbox add-on + /// [Language("Dropbox")] public interface IDropboxLanguage : ILanguage { - string CommunicationWait { get; } +#pragma warning disable 1591 + string CommunicationWait { get; } string Configure { get; } diff --git a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxConfigurationImpl.cs b/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxConfigurationImpl.cs index 5b4712b60..9e8291037 100644 --- a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxConfigurationImpl.cs +++ b/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxConfigurationImpl.cs @@ -25,8 +25,13 @@ using Greenshot.Core.Enums; namespace Greenshot.Addon.Dropbox.Configuration.Impl { + /// + /// Implementation of the IDropboxConfiguration + /// public class DropboxConfigurationImpl : IniSectionBase, IDropboxConfiguration { +#pragma warning disable 1591 + public string OutputFilePath { get; set; } public bool OutputFileAllowOverwrite { get; set; } public string OutputFileFilenamePattern { get; set; } diff --git a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs index 7f6ff18b3..555d3e5cd 100644 --- a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs +++ b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs @@ -45,6 +45,9 @@ using Newtonsoft.Json; namespace Greenshot.Addon.Dropbox { + /// + /// This is the destination implementation to export to dropbox + /// [Destination("Dropbox")] public sealed class DropboxDestination : AbstractDestination { @@ -60,7 +63,18 @@ namespace Greenshot.Addon.Dropbox private OAuth2Settings _oAuth2Settings; private IHttpBehaviour _oAuthHttpBehaviour; - public DropboxDestination( + /// + /// DI Coonstructor + /// + /// IDropboxConfiguration + /// IDropboxLanguage + /// IHttpConfiguration + /// IResourceProvider + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification + /// Func + public DropboxDestination( IDropboxConfiguration dropboxPluginConfiguration, IDropboxLanguage dropboxLanguage, IHttpConfiguration httpConfiguration, @@ -105,6 +119,7 @@ namespace Greenshot.Addon.Dropbox httpBehaviour.HttpSettings = httpConfiguration; } + /// public override IBitmapWithNativeSupport DisplayIcon { get @@ -117,9 +132,11 @@ namespace Greenshot.Addon.Dropbox } } - public override string Description => _dropboxLanguage.UploadMenuItem; + /// + public override string Description => _dropboxLanguage.UploadMenuItem; - public override async Task ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) + /// + public override async Task ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); var uploadUrl = await UploadAsync(surface).ConfigureAwait(true); diff --git a/src/Greenshot.Addon.Dropbox/ViewModels/DropboxConfigViewModel.cs b/src/Greenshot.Addon.Dropbox/ViewModels/DropboxConfigViewModel.cs index f538d4ca2..851c4d919 100644 --- a/src/Greenshot.Addon.Dropbox/ViewModels/DropboxConfigViewModel.cs +++ b/src/Greenshot.Addon.Dropbox/ViewModels/DropboxConfigViewModel.cs @@ -36,12 +36,27 @@ namespace Greenshot.Addon.Dropbox.ViewModels /// private CompositeDisposable _disposables; + /// + /// Provide IDropboxConfiguration to the view + /// public IDropboxConfiguration DropboxConfiguration { get; set; } + /// + /// Provide IDropboxLanguage to the view + /// public IDropboxLanguage DropboxLanguage { get; set; } + /// + /// Provide FileConfigPartViewModel to the view + /// public FileConfigPartViewModel FileConfigPartViewModel { get; private set; } + /// + /// DI constructor + /// + /// IDropboxConfiguration + /// IDropboxLanguage + /// FileConfigPartViewModel public DropboxConfigViewModel( IDropboxConfiguration dropboxConfiguration, IDropboxLanguage dropboxLanguage, @@ -53,6 +68,7 @@ namespace Greenshot.Addon.Dropbox.ViewModels FileConfigPartViewModel = fileConfigPartViewModel; } + /// public override void Initialize(IConfig config) { FileConfigPartViewModel.DestinationFileConfiguration = DropboxConfiguration; @@ -75,6 +91,7 @@ namespace Greenshot.Addon.Dropbox.ViewModels base.Initialize(config); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs index 6430663fe..8240e1423 100644 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs +++ b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs @@ -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 { diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs index b7373d79d..10ec1022c 100644 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs +++ b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs @@ -19,9 +19,13 @@ using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; +#pragma warning disable 1591 namespace Greenshot.Addon.ExternalCommand.Configuration { + /// + /// These are the translations for the external command settings + /// [Language("ExternalCommand")] [SuppressMessage("ReSharper", "UnusedMember.Global")] public interface IExternalCommandLanguage : ILanguage diff --git a/src/Greenshot.Addon.ExternalCommand/Entities/ExternalCommandDefinition.cs b/src/Greenshot.Addon.ExternalCommand/Entities/ExternalCommandDefinition.cs index 428fef48e..904beb948 100644 --- a/src/Greenshot.Addon.ExternalCommand/Entities/ExternalCommandDefinition.cs +++ b/src/Greenshot.Addon.ExternalCommand/Entities/ExternalCommandDefinition.cs @@ -19,6 +19,9 @@ namespace Greenshot.Addon.ExternalCommand.Entities { + /// + /// This defines an external command + /// public class ExternalCommandDefinition { /// diff --git a/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandConfigViewModel.cs b/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandConfigViewModel.cs index 153fc324c..f8299379a 100644 --- a/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandConfigViewModel.cs +++ b/src/Greenshot.Addon.ExternalCommand/ViewModels/ExternalCommandConfigViewModel.cs @@ -29,7 +29,7 @@ using Greenshot.Addons.ViewModels; namespace Greenshot.Addon.ExternalCommand.ViewModels { /// - /// Configuration for the external commands + /// Configuration for the external commands add-on /// public sealed class ExternalCommandConfigViewModel : SimpleConfigScreen { @@ -38,15 +38,39 @@ namespace Greenshot.Addon.ExternalCommand.ViewModels /// private CompositeDisposable _disposables; + /// + /// Provide the IExternalCommandConfiguration to the view + /// public IExternalCommandConfiguration ExternalCommandConfiguration { get; } + /// + /// Provide the IExternalCommandLanguage to the view + /// public IExternalCommandLanguage ExternalCommandLanguage { get; } + /// + /// Provide the IGreenshotLanguage to the view + /// public IGreenshotLanguage GreenshotLanguage { get; } + /// + /// Provide the FileConfigPartViewModel to the view + /// public FileConfigPartViewModel FileConfigPartViewModel { get; private set; } + + /// + /// Provide the ExternalCommandMasterViewModel to the view + /// public ExternalCommandMasterViewModel ExternalCommandMasterViewModel { get; } + /// + /// DI constructor + /// + /// IExternalCommandConfiguration + /// IExternalCommandLanguage + /// IGreenshotLanguage + /// FileConfigPartViewModel + /// ExternalCommandMasterViewModel public ExternalCommandConfigViewModel( IExternalCommandConfiguration externalCommandConfiguration, IExternalCommandLanguage externalCommandLanguage, @@ -61,6 +85,7 @@ namespace Greenshot.Addon.ExternalCommand.ViewModels ExternalCommandMasterViewModel = externalCommandMasterViewModel; } + /// public override void Initialize(IConfig config) { FileConfigPartViewModel.DestinationFileConfiguration = ExternalCommandConfiguration; @@ -83,18 +108,21 @@ namespace Greenshot.Addon.ExternalCommand.ViewModels base.Initialize(config); } + /// protected override void OnActivate() { base.OnActivate(); ExternalCommandMasterViewModel.ActivateWith(this); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); base.OnDeactivate(close); } + /// public override void Commit() { ExternalCommandMasterViewModel.Store(); diff --git a/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs b/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs index e9c6336ca..25778bd3a 100644 --- a/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs +++ b/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs @@ -22,11 +22,16 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Flickr.Configuration { + /// + /// Translations for the flickr add-on + /// [Language("Flickr")] [SuppressMessage("ReSharper", "UnusedMember.Global")] public interface IFlickrLanguage : ILanguage { - string CommunicationWait { get; } +#pragma warning disable 1591 + + string CommunicationWait { get; } string Configure { get; } diff --git a/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs b/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs index 5b1313607..936476eb3 100644 --- a/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs +++ b/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs @@ -27,14 +27,15 @@ using Greenshot.Addons.Core; namespace Greenshot.Addon.GooglePhotos.Configuration { /// - /// Description of GooglePhotosConfiguration. + /// Configuration for the google photos add-on /// [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; } diff --git a/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosLanguage.cs b/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosLanguage.cs index 3990eb979..d651d15a1 100644 --- a/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosLanguage.cs +++ b/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosLanguage.cs @@ -22,10 +22,15 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.GooglePhotos.Configuration { + /// + /// Translations for the google photos add-on + /// [Language("GooglePhotos")] [SuppressMessage("ReSharper", "UnusedMember.Global")] public interface IGooglePhotosLanguage : ILanguage { +#pragma warning disable 1591 + string CommunicationWait { get; } string Configure { get; } diff --git a/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs b/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs index 833ad7738..578282eb9 100644 --- a/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs +++ b/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs @@ -94,9 +94,11 @@ namespace Greenshot.Addon.GooglePhotos }; } - public override string Description => _googlePhotosLanguage.UploadMenuItem; + /// + public override string Description => _googlePhotosLanguage.UploadMenuItem; - public override IBitmapWithNativeSupport DisplayIcon + /// + public override IBitmapWithNativeSupport DisplayIcon { get { @@ -108,7 +110,8 @@ namespace Greenshot.Addon.GooglePhotos } } - public override async Task ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) + /// + public override async Task ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); var uploadUrl = await Upload(surface).ConfigureAwait(true); diff --git a/src/Greenshot.Addon.Imgur/Configuration/IImgurConfiguration.cs b/src/Greenshot.Addon.Imgur/Configuration/IImgurConfiguration.cs index 22588059a..e415bacae 100644 --- a/src/Greenshot.Addon.Imgur/Configuration/IImgurConfiguration.cs +++ b/src/Greenshot.Addon.Imgur/Configuration/IImgurConfiguration.cs @@ -28,13 +28,15 @@ using Greenshot.Addons.Core; namespace Greenshot.Addon.Imgur.Configuration { /// - /// Description of ImgurConfiguration. + /// Configuration for the Imgur add-on /// [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; } diff --git a/src/Greenshot.Addon.Imgur/Configuration/IImgurLanguage.cs b/src/Greenshot.Addon.Imgur/Configuration/IImgurLanguage.cs index 185478d4f..36bea7564 100644 --- a/src/Greenshot.Addon.Imgur/Configuration/IImgurLanguage.cs +++ b/src/Greenshot.Addon.Imgur/Configuration/IImgurLanguage.cs @@ -22,11 +22,16 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Imgur.Configuration { + /// + /// Translations for the Imgur add-on + /// [Language("Imgur")] [SuppressMessage("ReSharper", "UnusedMember.Global")] public interface IImgurLanguage : ILanguage { - string Cancel { get; } +#pragma warning disable 1591 + + string Cancel { get; } string ClearQuestion { get; } diff --git a/src/Greenshot.Addon.Imgur/Entities/ImgurData.cs b/src/Greenshot.Addon.Imgur/Entities/ImgurData.cs index 90ad4cb6a..7253c0d70 100644 --- a/src/Greenshot.Addon.Imgur/Entities/ImgurData.cs +++ b/src/Greenshot.Addon.Imgur/Entities/ImgurData.cs @@ -29,6 +29,7 @@ namespace Greenshot.Addon.Imgur.Entities /// public class ImgurData { +#pragma warning disable 1591 /// /// Id of the image /// diff --git a/src/Greenshot.Addon.Imgur/Entities/ImgurImage.cs b/src/Greenshot.Addon.Imgur/Entities/ImgurImage.cs index 25f30f9de..7764581f0 100644 --- a/src/Greenshot.Addon.Imgur/Entities/ImgurImage.cs +++ b/src/Greenshot.Addon.Imgur/Entities/ImgurImage.cs @@ -27,6 +27,7 @@ namespace Greenshot.Addon.Imgur.Entities /// public class ImgurImage { +#pragma warning disable 1591 [JsonIgnore] public IBitmapWithNativeSupport Image { get; set; } diff --git a/src/Greenshot.Addon.Imgur/ViewModels/ImgurConfigViewModel.cs b/src/Greenshot.Addon.Imgur/ViewModels/ImgurConfigViewModel.cs index c62f35394..f2ac62282 100644 --- a/src/Greenshot.Addon.Imgur/ViewModels/ImgurConfigViewModel.cs +++ b/src/Greenshot.Addon.Imgur/ViewModels/ImgurConfigViewModel.cs @@ -31,7 +31,7 @@ using Greenshot.Addons.ViewModels; namespace Greenshot.Addon.Imgur.ViewModels { /// - /// The imgure config VM + /// The imgur config view model /// 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 /// private CompositeDisposable _disposables; + private Func> ImgurHistoryViewModelFactory { get; } + /// + /// Provide IImgurConfiguration to the view + /// public IImgurConfiguration ImgurConfiguration { get; } + /// + /// Provide IImgurLanguage to the view + /// public IImgurLanguage ImgurLanguage { get; } + /// + /// Provide IWindowManager to the view + /// public IWindowManager WindowManager { get; } - public Func> ImgurHistoryViewModelFactory { get;} - + /// + /// Provide FileConfigPartViewModel to the view + /// public FileConfigPartViewModel FileConfigPartViewModel { get; } + /// + /// DI constructor + /// + /// IImgurConfiguration + /// IImgurLanguage + /// IWindowManager + /// Func + /// FileConfigPartViewModel public ImgurConfigViewModel( IImgurConfiguration imgurConfiguration, IImgurLanguage imgurLanguage , @@ -64,6 +83,8 @@ namespace Greenshot.Addon.Imgur.ViewModels ImgurHistoryViewModelFactory = imgurHistoryViewModelFactory; FileConfigPartViewModel = fileConfigPartViewModel; } + + /// 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); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); base.OnDeactivate(close); } + /// + /// Show the Imgur history view model + /// public void ShowHistory() { using (var imgurHistoryViewModel = ImgurHistoryViewModelFactory()) @@ -101,8 +126,14 @@ namespace Greenshot.Addon.Imgur.ViewModels } } + /// + /// Can the credentials be reset? + /// public bool CanResetCredentials => !ImgurConfiguration.AnonymousAccess && ImgurConfiguration.HasToken(); + /// + /// Reset the credentials + /// public void ResetCredentials() { ImgurConfiguration.ResetToken(); diff --git a/src/Greenshot.Addon.InternetExplorer/InternetExplorerCaptureHelper.cs b/src/Greenshot.Addon.InternetExplorer/InternetExplorerCaptureHelper.cs index 4378347b4..030302955 100644 --- a/src/Greenshot.Addon.InternetExplorer/InternetExplorerCaptureHelper.cs +++ b/src/Greenshot.Addon.InternetExplorer/InternetExplorerCaptureHelper.cs @@ -133,7 +133,7 @@ namespace Greenshot.Addon.InternetExplorer } /// - /// 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 /// /// List with KeyValuePair of InteropWindow and string public IList> GetBrowserTabs() diff --git a/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/DocumentContainer.cs b/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/DocumentContainer.cs index ca4334a55..237fe0145 100644 --- a/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/DocumentContainer.cs +++ b/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/DocumentContainer.cs @@ -31,6 +31,9 @@ using IServiceProvider = Greenshot.Addons.Interop.IServiceProvider; namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop { + /// + /// This contains the document + /// 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) + /// + /// Constructor + /// + /// IHTMLDocument2 + /// IInteropWindow + 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; } + /// + /// Url of the document + /// public string Url { get; private set; } + /// + /// Is this document hidden? + /// public bool IsHidden => ClientWidth == 0 || ClientHeight == 0; + /// + /// Width of the client + /// public int ClientWidth => ScaleX(GetAttributeAsInt("clientWidth")); + /// + /// Height of the client + /// public int ClientHeight => ScaleY(GetAttributeAsInt("clientHeight")); + /// + /// Width of the scroll area + /// public int ScrollWidth => ScaleX(GetAttributeAsInt("scrollWidth")); + /// + /// Height of the scroll area + /// 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; + /// + /// Left of the scroll area + /// public int ScrollLeft { get { return ScaleX(GetAttributeAsInt("scrollLeft")); } set { SetAttribute("scrollLeft", UnscaleX(value)); } } + /// + /// Top of the scroll area + /// public int ScrollTop { get { return ScaleY(GetAttributeAsInt("scrollTop")); } set { SetAttribute("scrollTop", UnscaleY(value)); } } + /// + /// The list of frames + /// public IList Frames { get; } = new List(); /// @@ -377,11 +412,11 @@ namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop } } - /// - /// Corrent the frame locations with the information - /// - /// - private void CorrectFrameLocations(IHTMLElement frameElement) + /// + /// Correct the frame locations with the information + /// + /// IHTMLElement + private void CorrectFrameLocations(IHTMLElement frameElement) { long x = 0; long y = 0; diff --git a/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/IWebBrowser2.cs b/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/IWebBrowser2.cs index 0b36df272..633cc4d11 100644 --- a/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/IWebBrowser2.cs +++ b/src/Greenshot.Addon.InternetExplorer/InternetExplorerInterop/IWebBrowser2.cs @@ -18,20 +18,13 @@ // along with this program. If not, see . 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; -// } -// } + /// + /// The IWebBrowser2 is used to communicate and automate Internet Explorer + /// [ComImport] [TypeLibType(TypeLibTypeFlags.FOleAutomation | TypeLibTypeFlags.FDual | diff --git a/src/Greenshot.Addon.Jira/Configuration/IJiraConfiguration.cs b/src/Greenshot.Addon.Jira/Configuration/IJiraConfiguration.cs index 4a5adcfe7..6c81ffc48 100644 --- a/src/Greenshot.Addon.Jira/Configuration/IJiraConfiguration.cs +++ b/src/Greenshot.Addon.Jira/Configuration/IJiraConfiguration.cs @@ -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; } diff --git a/src/Greenshot.Addon.Jira/Configuration/IJiraLanguage.cs b/src/Greenshot.Addon.Jira/Configuration/IJiraLanguage.cs index d5a229925..053666f7d 100644 --- a/src/Greenshot.Addon.Jira/Configuration/IJiraLanguage.cs +++ b/src/Greenshot.Addon.Jira/Configuration/IJiraLanguage.cs @@ -17,14 +17,18 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -using System.ComponentModel; using Dapplo.Config.Language; + namespace Greenshot.Addon.Jira.Configuration { + /// + /// Translations for the Jira add-on + /// [Language("Jira")] public interface IJiraLanguage : ILanguage { +#pragma warning disable 1591 string Cancel { get; } string ColumnAssignee { get; } diff --git a/src/Greenshot.Addon.Jira/ViewModels/JiraConfigViewModel.cs b/src/Greenshot.Addon.Jira/ViewModels/JiraConfigViewModel.cs index 05211fbe0..6e86a9f6a 100644 --- a/src/Greenshot.Addon.Jira/ViewModels/JiraConfigViewModel.cs +++ b/src/Greenshot.Addon.Jira/ViewModels/JiraConfigViewModel.cs @@ -26,6 +26,9 @@ using Greenshot.Addons.ViewModels; namespace Greenshot.Addon.Jira.ViewModels { + /// + /// This is the view model for the Jira configuration + /// public sealed class JiraConfigViewModel : SimpleConfigScreen { /// @@ -33,12 +36,27 @@ namespace Greenshot.Addon.Jira.ViewModels /// private CompositeDisposable _disposables; + /// + /// Provide IJiraConfiguration to the view + /// public IJiraConfiguration JiraConfiguration { get; } + /// + /// Provide IJiraLanguage to the view + /// public IJiraLanguage JiraLanguage { get; } + /// + /// Provide FileConfigPartViewModel to the view + /// public FileConfigPartViewModel FileConfigPartViewModel { get; } + /// + /// DI constructor + /// + /// IJiraConfiguration + /// IJiraLanguage + /// FileConfigPartViewModel public JiraConfigViewModel( IJiraConfiguration jiraConfiguration, IJiraLanguage jiraLanguage, @@ -50,6 +68,7 @@ namespace Greenshot.Addon.Jira.ViewModels FileConfigPartViewModel = fileConfigPartViewModel; } + /// public override void Initialize(IConfig config) { FileConfigPartViewModel.DestinationFileConfiguration = JiraConfiguration; @@ -71,6 +90,7 @@ namespace Greenshot.Addon.Jira.ViewModels base.Initialize(config); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); diff --git a/src/Greenshot.Addon.Jira/ViewModels/JiraViewModel.cs b/src/Greenshot.Addon.Jira/ViewModels/JiraViewModel.cs index b81307970..b35912cdd 100644 --- a/src/Greenshot.Addon.Jira/ViewModels/JiraViewModel.cs +++ b/src/Greenshot.Addon.Jira/ViewModels/JiraViewModel.cs @@ -29,20 +29,39 @@ using Greenshot.Addon.Jira.Configuration; namespace Greenshot.Addon.Jira.ViewModels { + /// + /// The view model for a Jira + /// public sealed class JiraViewModel : Screen { /// /// Here all disposables are registered, so we can clean the up /// private CompositeDisposable _disposables; - + + /// + /// Provide IJiraConfiguration to the view + /// public IJiraConfiguration JiraConfiguration { get; } + + /// + /// Provide IJiraLanguage to the view + /// public IJiraLanguage JiraLanguage { get; } + /// + /// Provide JiraConnector to the view + /// public JiraConnector JiraConnector { get; } + /// + /// DI constructor + /// + /// IJiraConfiguration + /// IJiraLanguage + /// JiraConnector public JiraViewModel( IJiraConfiguration jiraConfiguration, IJiraLanguage jiraLanguage, @@ -73,7 +92,7 @@ namespace Greenshot.Addon.Jira.ViewModels /// public string Filename { get; set; } - + /// protected override void OnActivate() { // Prepare disposables @@ -121,10 +140,11 @@ namespace Greenshot.Addon.Jira.ViewModels } /// - /// + /// Can this be uploaded? /// public bool CanUpload { get; private set; } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/AbstractAdorner.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/AbstractAdorner.cs index 21cfed145..1a41cb512 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/AbstractAdorner.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/AbstractAdorner.cs @@ -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; /// /// Returns the cursor for when the mouse is over the adorner @@ -101,7 +101,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners /// public virtual void MouseUp(object sender, MouseEventArgs mouseEventArgs) { - EditStatus = EditStatus.IDLE; + EditStatus = EditStatus.Idle; } /// @@ -109,7 +109,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners /// public virtual bool IsActive { - get { return EditStatus != EditStatus.IDLE && EditStatus != EditStatus.UNDRAWN; } + get { return EditStatus != EditStatus.Idle && EditStatus != EditStatus.Undrawn; } } /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/MoveAdorner.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/MoveAdorner.cs index 4e8e15753..5826b4a96 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/MoveAdorner.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/MoveAdorner.cs @@ -101,7 +101,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners /// 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 /// public override void MouseMove(object sender, MouseEventArgs mouseEventArgs) { - if (EditStatus != EditStatus.RESIZING) + if (EditStatus != EditStatus.Resizing) { return; } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/ResizeAdorner.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/ResizeAdorner.cs index 36305032a..8a611d8b7 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/ResizeAdorner.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/ResizeAdorner.cs @@ -128,7 +128,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners /// 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 /// public override void MouseMove(object sender, MouseEventArgs mouseEventArgs) { - if (EditStatus != EditStatus.RESIZING) + if (EditStatus != EditStatus.Resizing) { return; } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/TargetAdorner.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/TargetAdorner.cs index 2940899e9..a2e53b6c6 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/TargetAdorner.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Adorners/TargetAdorner.cs @@ -46,7 +46,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners /// public override void MouseDown(object sender, MouseEventArgs mouseEventArgs) { - EditStatus = EditStatus.MOVING; + EditStatus = EditStatus.Moving; } /// @@ -56,7 +56,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Adorners /// public override void MouseMove(object sender, MouseEventArgs mouseEventArgs) { - if (EditStatus != EditStatus.MOVING) + if (EditStatus != EditStatus.Moving) { return; } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/CropContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/CropContainer.cs index fbef513db..5d9747103 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/CropContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/CropContainer.cs @@ -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() diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainer.cs index 35ec6f29a..0b7edd902 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainer.cs @@ -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); } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs index fee2af85f..1ba5d540e 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs @@ -209,7 +209,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { /// true if an filter intersects 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 { /// /// Triggers all elements in the list ot be redrawn. /// - /// the to the bitmap related Graphics object + /// the to the bitmap related Graphics object /// IBitmapWithNativeSupport to draw /// the rendermode in which the element is to be drawn /// - 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); } } } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldType.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldType.cs index 2f9b60c74..c796b732a 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldType.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldType.cs @@ -41,12 +41,14 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields /// public Type ValueType { get; }= typeof(T); - public override string ToString() + /// + public override string ToString() { return Name; } - public override int GetHashCode() + /// + 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) + /// + public override bool Equals(object obj) { var other = obj as FieldType; if (other == null) @@ -69,12 +72,24 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields return Equals(Name, other.Name); } - public static bool operator ==(FieldType a, FieldType b) + /// + /// Implements a equals operator + /// + /// FieldType + /// FieldType + /// bool + public static bool operator ==(FieldType a, FieldType b) { return Equals(a, b); } - public static bool operator !=(FieldType a, FieldType b) + /// + /// Implements a not equals operator + /// + /// FieldType + /// FieldType + /// bool + public static bool operator !=(FieldType a, FieldType b) { return !Equals(a, b); } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs index bbc20abd4..3fc5a4043 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs @@ -28,27 +28,87 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields /// public static class FieldTypes { + /// + /// This field specifies which arrow heads are used + /// public static readonly IFieldType ARROWHEADS = new FieldType("ARROWHEADS"); + /// + /// This field specifies the blur radius + /// public static readonly IFieldType BLUR_RADIUS = new FieldType("BLUR_RADIUS"); + /// + /// This field specifies the brightness of a filter + /// public static readonly IFieldType BRIGHTNESS = new FieldType("BRIGHTNESS"); + /// + /// This field specifies the fill color + /// public static readonly IFieldType FILL_COLOR = new FieldType("FILL_COLOR"); + /// + /// This field specifies if the font is bold + /// public static readonly IFieldType FONT_BOLD = new FieldType("FONT_BOLD"); + /// + /// This field specifies the font family + /// public static readonly IFieldType FONT_FAMILY = new FieldType("FONT_FAMILY"); + /// + /// This field specifies if the font is italic + /// public static readonly IFieldType FONT_ITALIC = new FieldType("FONT_ITALIC"); + /// + /// This field specifies the font size + /// public static readonly IFieldType FONT_SIZE = new FieldType("FONT_SIZE"); + /// + /// This field specifies the horizontal text alignment + /// public static readonly IFieldType TEXT_HORIZONTAL_ALIGNMENT = new FieldType("TEXT_HORIZONTAL_ALIGNMENT"); + /// + /// This field specifies the vertical text alignment + /// public static readonly IFieldType TEXT_VERTICAL_ALIGNMENT = new FieldType("TEXT_VERTICAL_ALIGNMENT"); + /// + /// This field specifies the highlight color + /// public static readonly IFieldType HIGHLIGHT_COLOR = new FieldType("HIGHLIGHT_COLOR"); + /// + /// This field specifies the line color + /// public static readonly IFieldType LINE_COLOR = new FieldType("LINE_COLOR"); + /// + /// This field specifies the line thickness + /// public static readonly IFieldType LINE_THICKNESS = new FieldType("LINE_THICKNESS"); + /// + /// This field specifies the magnification factor for the magnification filter + /// public static readonly IFieldType MAGNIFICATION_FACTOR = new FieldType("MAGNIFICATION_FACTOR"); + /// + /// This field specifies the pixel size for the pixelate filter + /// public static readonly IFieldType PIXEL_SIZE = new FieldType("PIXEL_SIZE"); + /// + /// This field specifies if a shadow should be rendered + /// public static readonly IFieldType SHADOW = new FieldType("SHADOW"); - public static readonly IFieldType PREPARED_FILTER_OBFUSCATE = new FieldType("PREPARED_FILTER_OBFUSCATE"); - public static readonly IFieldType PREPARED_FILTER_HIGHLIGHT = new FieldType("PREPARED_FILTER_HIGHLIGHT"); + /// + /// This field specifies if this is a obfuscate filter + /// + public static readonly IFieldType PREPARED_FILTER_OBFUSCATE = new FieldType("PREPARED_FILTER_OBFUSCATE"); + /// + /// This field specifies if this is a highlight filter + /// + public static readonly IFieldType PREPARED_FILTER_HIGHLIGHT = new FieldType("PREPARED_FILTER_HIGHLIGHT"); + /// + /// This field specifies some flags + /// public static readonly IFieldType FLAGS = new FieldType("FLAGS"); - public static IFieldType[] Values = + /// + /// All values + /// + 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 }; diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/FilterContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/FilterContainer.cs index 560011cd0..12c997dc3 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/FilterContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/FilterContainer.cs @@ -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 - } - + /// + /// Constructor + /// + /// + /// 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) + /// + protected override void OnDeserialized(StreamingContext streamingContext) { base.OnDeserialized(streamingContext); Init(); @@ -71,14 +56,16 @@ namespace Greenshot.Addon.LegacyEditor.Drawing CreateDefaultAdorners(); } - protected override void InitializeFields() + /// + 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) + /// + 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; } } } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/HighlightContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/HighlightContainer.cs index ae51a2fd4..e35e2b6c6 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/HighlightContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/HighlightContainer.cs @@ -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; } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/ObfuscateContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/ObfuscateContainer.cs index dd965b00f..13270f283 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/ObfuscateContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/ObfuscateContainer.cs @@ -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; } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/PreparedFilters.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/PreparedFilters.cs new file mode 100644 index 000000000..5762d24eb --- /dev/null +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/PreparedFilters.cs @@ -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 . +// +namespace Greenshot.Addon.LegacyEditor.Drawing +{ + /// + /// Defines the filter to use + /// + public enum PreparedFilter + { + /// + /// Use the blur filter + /// + Blur, + /// + /// Use the pixelize filter + /// + Pixelize, + /// + /// Use the text highlight filter + /// + TextHightlight, + /// + /// Use the area highlight filter + /// + AreaHighlight, + /// + /// Use the gray-scale filter + /// + Grayscale, + /// + /// Use the magnification filter + /// + Magnification + } +} \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs index 6cdc81050..7d05c8c80 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs @@ -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); diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/StepLabelContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/StepLabelContainer.cs index b074f856b..ae5ed7d33 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/StepLabelContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/StepLabelContainer.cs @@ -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); } /// diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs index c37cb4949..f749a7384 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs @@ -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; diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/TextContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/TextContainer.cs index bd33d5e92..e11fdbeb0 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/TextContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/TextContainer.cs @@ -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; diff --git a/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs b/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs index 3bb3e88c5..d89b869b2 100644 --- a/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs +++ b/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs @@ -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); diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs index aa480e589..4ff3b578e 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs @@ -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 // diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs index 5fc666c14..89c938109 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs @@ -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) diff --git a/src/Greenshot.Addon.Lutim/Configuration/ILutimLanguage.cs b/src/Greenshot.Addon.Lutim/Configuration/ILutimLanguage.cs index c8a2440cd..e53b20a11 100644 --- a/src/Greenshot.Addon.Lutim/Configuration/ILutimLanguage.cs +++ b/src/Greenshot.Addon.Lutim/Configuration/ILutimLanguage.cs @@ -22,9 +22,13 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Lutim.Configuration { + /// + /// Translations for the Lutim add-on + /// [Language("Lutim")] - public interface ILutimLanguage : ILanguage, INotifyPropertyChanged + public interface ILutimLanguage : ILanguage { +#pragma warning disable 1591 string Cancel { get; } string ClearQuestion { get; } diff --git a/src/Greenshot.Addon.Lutim/Entities/AddResult.cs b/src/Greenshot.Addon.Lutim/Entities/AddResult.cs index c0e47803a..54304a563 100644 --- a/src/Greenshot.Addon.Lutim/Entities/AddResult.cs +++ b/src/Greenshot.Addon.Lutim/Entities/AddResult.cs @@ -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 . + +using Newtonsoft.Json; namespace Greenshot.Addon.Lutim.Entities { + /// + /// The result of calling add + /// public class AddResult { +#pragma warning disable 1591 [JsonProperty("success")] public bool Success { get; set; } diff --git a/src/Greenshot.Addon.Lutim/Entities/LutimInfo.cs b/src/Greenshot.Addon.Lutim/Entities/LutimInfo.cs index f530f108f..07de3a41f 100644 --- a/src/Greenshot.Addon.Lutim/Entities/LutimInfo.cs +++ b/src/Greenshot.Addon.Lutim/Entities/LutimInfo.cs @@ -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 . + +using System; using System.Drawing; using System.IO; using Newtonsoft.Json; @@ -6,8 +25,12 @@ using Newtonsoft.Json.Converters; namespace Greenshot.Addon.Lutim.Entities { + /// + /// This is the entity which Lutim returns + /// public class LutimInfo { +#pragma warning disable 1591 [JsonProperty("real_short")] public string RealShort { get; set; } diff --git a/src/Greenshot.Addon.Lutim/LutimDestination.cs b/src/Greenshot.Addon.Lutim/LutimDestination.cs index 04202227a..68cc01a7a 100644 --- a/src/Greenshot.Addon.Lutim/LutimDestination.cs +++ b/src/Greenshot.Addon.Lutim/LutimDestination.cs @@ -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 . - */ +// 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 . using System; using System.Threading; @@ -52,6 +50,17 @@ namespace Greenshot.Addon.Lutim { private readonly ExportNotification _exportNotification; private readonly Func> _pleaseWaitFormFactory; + /// + /// DI constructor + /// + /// ILutimConfiguration + /// ILutimLanguage + /// LutimApi + /// IResourceProvider + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification + /// Func public LutimDestination(ILutimConfiguration lutimConfiguration, ILutimLanguage lutimLanguage, LutimApi lutimApi, @@ -70,9 +79,11 @@ namespace Greenshot.Addon.Lutim { _pleaseWaitFormFactory = pleaseWaitFormFactory; } - public override string Description => _lutimLanguage.UploadMenuItem; + /// + public override string Description => _lutimLanguage.UploadMenuItem; - public override IBitmapWithNativeSupport DisplayIcon { + /// + 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 { } } + /// public override async Task ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var uploadUrl = await Upload(surface).ConfigureAwait(true); diff --git a/src/Greenshot.Addon.Lutim/ViewModels/LutimConfigViewModel.cs b/src/Greenshot.Addon.Lutim/ViewModels/LutimConfigViewModel.cs index 985f56cb7..8ecf46a1b 100644 --- a/src/Greenshot.Addon.Lutim/ViewModels/LutimConfigViewModel.cs +++ b/src/Greenshot.Addon.Lutim/ViewModels/LutimConfigViewModel.cs @@ -36,10 +36,27 @@ namespace Greenshot.Addon.Lutim.ViewModels /// private CompositeDisposable _disposables; + /// + /// Provide ILutimConfiguration to the view + /// public ILutimConfiguration LutimConfiguration { get; } + + /// + /// Provide ILutimLanguage to the view + /// public ILutimLanguage LutimLanguage { get; } + + /// + /// Provide FileConfigPartViewModel to the view + /// public FileConfigPartViewModel FileConfigPartViewModel { get; } + /// + /// DI constructor + /// + /// ILutimConfiguration + /// ILutimLanguage + /// FileConfigPartViewModel public LutimConfigViewModel( ILutimConfiguration lutimConfiguration, ILutimLanguage lutimLanguage, @@ -50,6 +67,7 @@ namespace Greenshot.Addon.Lutim.ViewModels FileConfigPartViewModel = fileConfigPartViewModel; } + /// public override void Initialize(IConfig config) { FileConfigPartViewModel.DestinationFileConfiguration = LutimConfiguration; @@ -72,6 +90,7 @@ namespace Greenshot.Addon.Lutim.ViewModels base.Initialize(config); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); diff --git a/src/Greenshot.Addon.Lutim/ViewModels/LutimHistoryViewModel.cs b/src/Greenshot.Addon.Lutim/ViewModels/LutimHistoryViewModel.cs index 935fb41c7..3e769230e 100644 --- a/src/Greenshot.Addon.Lutim/ViewModels/LutimHistoryViewModel.cs +++ b/src/Greenshot.Addon.Lutim/ViewModels/LutimHistoryViewModel.cs @@ -34,6 +34,9 @@ using Greenshot.Addons.Extensions; namespace Greenshot.Addon.Lutim.ViewModels { + /// + /// The view model for the Lutim history + /// public sealed class LutimHistoryViewModel : Screen { private static readonly LogSource Log = new LogSource(); @@ -44,10 +47,28 @@ namespace Greenshot.Addon.Lutim.ViewModels /// private CompositeDisposable _disposables; + /// + /// Provide ILutimConfiguration to the view + /// public ILutimConfiguration LutimConfiguration { get; set; } + + /// + /// Provide ILutimLanguage to the view + /// public ILutimLanguage LutimLanguage { get; set; } + + /// + /// Provide IGreenshotLanguage to the view + /// public IGreenshotLanguage GreenshotLanguage { get; set; } + /// + /// DI constructor + /// + /// ILutimConfiguration + /// ILutimLanguage + /// LutimApi + /// IGreenshotLanguage public LutimHistoryViewModel( ILutimConfiguration lutimConfiguration, ILutimLanguage lutimLanguage, @@ -64,6 +85,7 @@ namespace Greenshot.Addon.Lutim.ViewModels /// public IList LutimHistory { get; } = new BindableCollection(); + /// protected override void OnActivate() { // Prepare disposables @@ -77,6 +99,7 @@ namespace Greenshot.Addon.Lutim.ViewModels _disposables.Add(lutimHistoryLanguageBinding); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); @@ -128,17 +151,33 @@ namespace Greenshot.Addon.Lutim.ViewModels } } + /// + /// The currently selected Lutim entry + /// public AddResult SelectedLutim { get; private set; } + /// + /// Is it possible to delete + /// public bool CanDelete => true; + /// + /// Delete the current selected Lutim + /// + /// Task public async Task Delete() { await _lutimApi.DeleteLutimImage(SelectedLutim); } + /// + /// Can the current selected Lutim entry be copied to the clipboard + /// public bool CanCopyToClipboard => true; + /// + /// Copy current selected Lutim entry to the clipboard + /// public void CopyToClipboard() { // TODO: Build url @@ -149,6 +188,9 @@ namespace Greenshot.Addon.Lutim.ViewModels } } + /// + /// Clear the whole history + /// public void ClearHistory() { LutimConfiguration.RuntimeLutimHistory.Clear(); @@ -156,9 +198,12 @@ namespace Greenshot.Addon.Lutim.ViewModels LutimHistory.Clear(); } + /// + /// Show the current selected Lutim entry in the browser + /// public void Show() { - var link = SelectedLutim.LutimInfo.Short; + var link = SelectedLutim?.LutimInfo.Short; if (link != null) { Process.Start(link); diff --git a/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveConfiguration.cs b/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveConfiguration.cs index 83508c41b..ffc7c0e40 100644 --- a/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveConfiguration.cs +++ b/src/Greenshot.Addon.OneDrive/Configuration/IOneDriveConfiguration.cs @@ -25,10 +25,14 @@ using Greenshot.Addons.Core; namespace Greenshot.Addon.OneDrive.Configuration { + /// + /// The one drive configuration + /// [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; } diff --git a/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs b/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs index e64d9e94f..7bdbd0827 100644 --- a/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs +++ b/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs @@ -63,6 +63,17 @@ namespace Greenshot.Addon.OneDrive private readonly HttpBehaviour _oneDriveHttpBehaviour; + /// + /// DI constructor + /// + /// IOneDriveConfiguration + /// IOneDriveLanguage + /// IHttpConfiguration + /// IResourceProvider + /// Func + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification public OneDriveDestination( IOneDriveConfiguration oneDriveConfiguration, IOneDriveLanguage oneDriveLanguage, @@ -106,8 +117,10 @@ namespace Greenshot.Addon.OneDrive }; } + /// public override string Description => _oneDriveLanguage.UploadMenuItem; + /// public override IBitmapWithNativeSupport DisplayIcon { get @@ -120,6 +133,7 @@ namespace Greenshot.Addon.OneDrive } } + /// public override async Task ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { diff --git a/src/Greenshot.Addon.OneDrive/OneDriveLinkType.cs b/src/Greenshot.Addon.OneDrive/OneDriveLinkType.cs index 4d71dfd4b..00d9aa9e0 100644 --- a/src/Greenshot.Addon.OneDrive/OneDriveLinkType.cs +++ b/src/Greenshot.Addon.OneDrive/OneDriveLinkType.cs @@ -19,6 +19,9 @@ namespace Greenshot.Addon.OneDrive { + /// + /// Defines the type of link in the one-drive export + /// public enum OneDriveLinkType { @private,//only user can access diff --git a/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketConfiguration.cs b/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketConfiguration.cs index e9d7ccf06..45030d91d 100644 --- a/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketConfiguration.cs +++ b/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketConfiguration.cs @@ -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 { diff --git a/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketLanguage.cs b/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketLanguage.cs index da933785e..2bb597ee4 100644 --- a/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketLanguage.cs +++ b/src/Greenshot.Addon.Photobucket/Configuration/IPhotobucketLanguage.cs @@ -22,9 +22,13 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Photobucket.Configuration { + /// + /// This contains the translations for the photo bucket add-on + /// [Language("Photobucket")] public interface IPhotobucketLanguage : ILanguage, INotifyPropertyChanged { +#pragma warning disable 1591 string CommunicationWait { get; } string Configure { get; } diff --git a/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs b/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs index a34d67396..2f5ef0f74 100644 --- a/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs +++ b/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs @@ -58,6 +58,16 @@ namespace Greenshot.Addon.Photobucket private readonly OAuth1HttpBehaviour _oAuthHttpBehaviour; private IList _albumsCache; + /// + /// + /// + /// IPhotobucketConfiguration + /// IPhotobucketLanguage + /// IHttpConfiguration + /// IResourceProvider + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification public PhotobucketDestination( IPhotobucketConfiguration photobucketConfiguration, IPhotobucketLanguage photobucketLanguage, @@ -133,7 +143,18 @@ namespace Greenshot.Addon.Photobucket _oAuthHttpBehaviour = oAuthHttpBehaviour; } - protected PhotobucketDestination( + /// + /// DI constructor + /// + /// IPhotobucketConfiguration + /// IPhotobucketLanguage + /// IHttpConfiguration + /// IResourceProvider + /// string + /// ICoreConfiguration + /// IGreenshotLanguage + /// ExportNotification + protected PhotobucketDestination( IPhotobucketConfiguration photobucketConfiguration, IPhotobucketLanguage photobucketLanguage, IHttpConfiguration httpConfiguration, @@ -147,7 +168,8 @@ namespace Greenshot.Addon.Photobucket _albumPath = albumPath; } - public override string Description + /// + public override string Description { get { @@ -159,7 +181,8 @@ namespace Greenshot.Addon.Photobucket } } - public override IBitmapWithNativeSupport DisplayIcon + /// + public override IBitmapWithNativeSupport DisplayIcon { get { @@ -171,9 +194,11 @@ namespace Greenshot.Addon.Photobucket } } - public override bool IsDynamic => true; + /// + public override bool IsDynamic => true; - public override IEnumerable DynamicDestinations() + /// + public override IEnumerable DynamicDestinations() { IList albums = null; try diff --git a/src/Greenshot.Addon.Photobucket/PhotobucketInfo.cs b/src/Greenshot.Addon.Photobucket/PhotobucketInfo.cs index 8d6906577..20c69ad8c 100644 --- a/src/Greenshot.Addon.Photobucket/PhotobucketInfo.cs +++ b/src/Greenshot.Addon.Photobucket/PhotobucketInfo.cs @@ -24,16 +24,25 @@ using Dapplo.Log; namespace Greenshot.Addon.Photobucket { /// - /// Description of PhotobucketInfo. + /// Information about a photobucket upload /// public class PhotobucketInfo { private static readonly LogSource Log = new LogSource(); + /// + /// Link to the original file + /// public string Original { get; set; } + /// + /// Link to the page + /// public string Page { get; set; } + /// + /// Link to the thumbnail + /// public string Thumbnail { get; set; } /// diff --git a/src/Greenshot.Addon.Photobucket/ViewModels/PhotobucketConfigViewModel.cs b/src/Greenshot.Addon.Photobucket/ViewModels/PhotobucketConfigViewModel.cs index ccf7569c2..682a7cfa1 100644 --- a/src/Greenshot.Addon.Photobucket/ViewModels/PhotobucketConfigViewModel.cs +++ b/src/Greenshot.Addon.Photobucket/ViewModels/PhotobucketConfigViewModel.cs @@ -27,6 +27,9 @@ using Greenshot.Addons.ViewModels; namespace Greenshot.Addon.Photobucket.ViewModels { + /// + /// This is the view model for the photobucket config + /// public sealed class PhotobucketConfigViewModel : SimpleConfigScreen { /// @@ -34,11 +37,30 @@ namespace Greenshot.Addon.Photobucket.ViewModels /// private CompositeDisposable _disposables; + /// + /// Provide the IPhotobucketConfiguration to the view + /// public IPhotobucketConfiguration PhotobucketConfiguration { get; } + /// + /// Provide the IPhotobucketLanguage to the view + /// public IPhotobucketLanguage PhotobucketLanguage { get; } + /// + /// Provide the IGreenshotLanguage to the view + /// public IGreenshotLanguage GreenshotLanguage { get; } + /// + /// Provide the FileConfigPartViewModel to the view + /// public FileConfigPartViewModel FileConfigPartViewModel { get; } + /// + /// DI constructor + /// + /// IPhotobucketConfiguration + /// IPhotobucketLanguage + /// IGreenshotLanguage + /// FileConfigPartViewModel public PhotobucketConfigViewModel( IPhotobucketConfiguration photobucketConfiguration, IPhotobucketLanguage photobucketLanguage, @@ -51,6 +73,7 @@ namespace Greenshot.Addon.Photobucket.ViewModels FileConfigPartViewModel = fileConfigPartViewModel; } + /// public override void Initialize(IConfig config) { FileConfigPartViewModel.DestinationFileConfiguration = PhotobucketConfiguration; @@ -72,6 +95,7 @@ namespace Greenshot.Addon.Photobucket.ViewModels base.Initialize(config); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); diff --git a/src/Greenshot.Addon.Tfs/Configuration/ITfsConfiguration.cs b/src/Greenshot.Addon.Tfs/Configuration/ITfsConfiguration.cs index fc3d8ecd3..03fb1260d 100644 --- a/src/Greenshot.Addon.Tfs/Configuration/ITfsConfiguration.cs +++ b/src/Greenshot.Addon.Tfs/Configuration/ITfsConfiguration.cs @@ -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 { + /// + /// This contains the TFS add-on configuration + /// [IniSection("Tfs")] [Description("Greenshot Tfs Addon configuration")] public interface ITfsConfiguration : IIniSection, IDestinationFileConfiguration diff --git a/src/Greenshot.Addon.Tfs/Configuration/ITfsLanguage.cs b/src/Greenshot.Addon.Tfs/Configuration/ITfsLanguage.cs index 8c0693797..cf3ce6792 100644 --- a/src/Greenshot.Addon.Tfs/Configuration/ITfsLanguage.cs +++ b/src/Greenshot.Addon.Tfs/Configuration/ITfsLanguage.cs @@ -17,13 +17,16 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -using System.ComponentModel; using Dapplo.Config.Language; -namespace Greenshot.Addon.Tfs +namespace Greenshot.Addon.Tfs.Configuration { + /// + /// This contains the translations which are available for the TFS add-on + /// [Language("Tfs")] - public interface ITfsLanguage : ILanguage, INotifyPropertyChanged +#pragma warning disable 1591 + public interface ITfsLanguage : ILanguage { string CommunicationWait { get; } diff --git a/src/Greenshot.Addon.Tfs/Entities/Attributes.cs b/src/Greenshot.Addon.Tfs/Entities/Attributes.cs index 3fd8cce0f..f276767b9 100644 --- a/src/Greenshot.Addon.Tfs/Entities/Attributes.cs +++ b/src/Greenshot.Addon.Tfs/Entities/Attributes.cs @@ -21,9 +21,15 @@ using Newtonsoft.Json; namespace Greenshot.Addon.Tfs.Entities { + /// + /// This is the attribute entity for the TFS communication + /// [JsonObject] public class Attributes { + /// + /// A comment in the attribute + /// [JsonProperty("comment")] public string Comment { get; set; } } diff --git a/src/Greenshot.Addon.Tfs/Entities/Item.cs b/src/Greenshot.Addon.Tfs/Entities/Item.cs index a9ef1315e..962cec44b 100644 --- a/src/Greenshot.Addon.Tfs/Entities/Item.cs +++ b/src/Greenshot.Addon.Tfs/Entities/Item.cs @@ -28,9 +28,15 @@ namespace Greenshot.Addon.Tfs.Entities [JsonObject] public class CreateAttachmentResult { + /// + /// The ID of the attachment + /// [JsonProperty("id")] - public string id { get; set; } + public string Id { get; set; } + /// + /// The URL where the attachment can be found + /// [JsonProperty("url")] public Uri Url { get; set; } } diff --git a/src/Greenshot.Addon.Tfs/Entities/Operation.cs b/src/Greenshot.Addon.Tfs/Entities/Operation.cs index e9d44c7c6..2cd8b4bac 100644 --- a/src/Greenshot.Addon.Tfs/Entities/Operation.cs +++ b/src/Greenshot.Addon.Tfs/Entities/Operation.cs @@ -27,11 +27,21 @@ namespace Greenshot.Addon.Tfs.Entities [JsonObject] public class Operation { + /// + /// Type of the operation + /// [JsonProperty("op")] public string OperationType { get; set; } + /// + /// Path of the operation + /// [JsonProperty("path")] public string Path { get; set; } + + /// + /// Value for the operation + /// [JsonProperty("value")] public Value Value { get; set; } } diff --git a/src/Greenshot.Addon.Tfs/Entities/Value.cs b/src/Greenshot.Addon.Tfs/Entities/Value.cs index 56af20a69..d2e81ccab 100644 --- a/src/Greenshot.Addon.Tfs/Entities/Value.cs +++ b/src/Greenshot.Addon.Tfs/Entities/Value.cs @@ -22,15 +22,27 @@ using Newtonsoft.Json; namespace Greenshot.Addon.Tfs.Entities { + /// + /// Describes a value + /// [JsonObject] public class Value { + /// + /// The relation + /// [JsonProperty("rel")] public string Relation { get; set; } + /// + /// The URL + /// [JsonProperty("url")] public Uri Url { get; set; } + /// + /// The attributes + /// [JsonProperty("attributes")] public Attributes Attributes { get; set; } } diff --git a/src/Greenshot.Addon.Tfs/Entities/WorkItemFields.cs b/src/Greenshot.Addon.Tfs/Entities/WorkItemFields.cs index 44ee06454..753cb9d14 100644 --- a/src/Greenshot.Addon.Tfs/Entities/WorkItemFields.cs +++ b/src/Greenshot.Addon.Tfs/Entities/WorkItemFields.cs @@ -21,15 +21,27 @@ using Newtonsoft.Json; namespace Greenshot.Addon.Tfs.Entities { + /// + /// Work item fields + /// [JsonObject] public class WorkItemFields { + /// + /// Title of the work item + /// [JsonProperty("System.Title")] public string Title { get; set; } + /// + /// Type for the work item + /// [JsonProperty("System.WorkItemType")] public string WorkItemType { get; set; } + /// + /// State of the work item + /// [JsonProperty("System.State")] public string State { get; set; } } diff --git a/src/Greenshot.Addon.Tfs/Entities/WorkItemList.cs b/src/Greenshot.Addon.Tfs/Entities/WorkItemList.cs index 7310d33c5..0aa8be0be 100644 --- a/src/Greenshot.Addon.Tfs/Entities/WorkItemList.cs +++ b/src/Greenshot.Addon.Tfs/Entities/WorkItemList.cs @@ -22,11 +22,21 @@ using Newtonsoft.Json; namespace Greenshot.Addon.Tfs.Entities { + /// + /// A list of work items + /// [JsonObject] public class WorkItemList { + /// + /// The count for this list + /// [JsonProperty("count")] public int Count { get; set; } + + /// + /// The items + /// [JsonProperty("value")] public IList Items { get; set; } } diff --git a/src/Greenshot.Addon.Tfs/Entities/WorkItemQueryResult.cs b/src/Greenshot.Addon.Tfs/Entities/WorkItemQueryResult.cs index d04542359..175e6c0bc 100644 --- a/src/Greenshot.Addon.Tfs/Entities/WorkItemQueryResult.cs +++ b/src/Greenshot.Addon.Tfs/Entities/WorkItemQueryResult.cs @@ -22,9 +22,15 @@ using Newtonsoft.Json; namespace Greenshot.Addon.Tfs.Entities { + /// + /// The result of a query + /// [JsonObject] public class WorkItemQueryResult { + /// + /// The work items + /// [JsonProperty("workItems")] public IList Items { get; set; } } diff --git a/src/Greenshot.Addon.Tfs/Entities/Workitem.cs b/src/Greenshot.Addon.Tfs/Entities/Workitem.cs index 8ef675f8c..e336fd6bd 100644 --- a/src/Greenshot.Addon.Tfs/Entities/Workitem.cs +++ b/src/Greenshot.Addon.Tfs/Entities/Workitem.cs @@ -22,18 +22,33 @@ using Newtonsoft.Json; namespace Greenshot.Addon.Tfs.Entities { + /// + /// The workitem entity + /// [JsonObject] public class WorkItem { + /// + /// ID of the workitem + /// [JsonProperty("id")] public long Id { get; set; } + /// + /// The revision of the workitem + /// [JsonProperty("rev")] - public int Reversion { get; set; } + public int Revision { get; set; } + /// + /// The URL of the workitem + /// [JsonProperty("url")] public Uri Url { get; set; } + /// + /// The fields of the workitem + /// [JsonProperty("fields")] public WorkItemFields Fields { get; set; } } diff --git a/src/Greenshot.Addon.Tfs/TfsAddonModule.cs b/src/Greenshot.Addon.Tfs/TfsAddonModule.cs index b53aedbd0..281aa777f 100644 --- a/src/Greenshot.Addon.Tfs/TfsAddonModule.cs +++ b/src/Greenshot.Addon.Tfs/TfsAddonModule.cs @@ -32,6 +32,7 @@ namespace Greenshot.Addon.Tfs /// public class TfsAddonModule : AddonModule { + /// protected override void Load(ContainerBuilder builder) { builder diff --git a/src/Greenshot.Addon.Tfs/TfsClient.cs b/src/Greenshot.Addon.Tfs/TfsClient.cs index 382e404ef..33bd4e714 100644 --- a/src/Greenshot.Addon.Tfs/TfsClient.cs +++ b/src/Greenshot.Addon.Tfs/TfsClient.cs @@ -37,7 +37,7 @@ using Newtonsoft.Json.Linq; namespace Greenshot.Addon.Tfs { /// - /// This capsulates the TFS api calls + /// This encapsulates the TFS api calls /// public class TfsClient { @@ -45,6 +45,12 @@ namespace Greenshot.Addon.Tfs private readonly ITfsConfiguration _tfsConfiguration; private readonly HttpBehaviour _tfsHttpBehaviour; + /// + /// DI constructor + /// + /// ICoreConfiguration + /// ITfsConfiguration + /// IHttpConfiguration public TfsClient( ICoreConfiguration coreConfiguration, ITfsConfiguration tfsConfiguration, @@ -69,9 +75,20 @@ namespace Greenshot.Addon.Tfs } + /// + /// Is it possible to update? + /// public bool CanUpdate => _tfsConfiguration.TfsUri != null && !string.IsNullOrEmpty(_tfsConfiguration.ApiKey); + + /// + /// The work items for this client + /// public IDictionary WorkItems { get; } = new Dictionary(); + /// + /// Request a work item update + /// + /// public async Task UpdateWorkItems() { if (!CanUpdate) @@ -85,7 +102,7 @@ namespace Greenshot.Addon.Tfs } } /// - /// Retrieve the own workitems + /// Retrieve the own work items /// /// WorkItemList public async Task GetOwnWorkitems() diff --git a/src/Greenshot.Addon.Tfs/TfsDestination.cs b/src/Greenshot.Addon.Tfs/TfsDestination.cs index ba9cbdc51..74bdc56c4 100644 --- a/src/Greenshot.Addon.Tfs/TfsDestination.cs +++ b/src/Greenshot.Addon.Tfs/TfsDestination.cs @@ -40,7 +40,7 @@ using Greenshot.Gfx; namespace Greenshot.Addon.Tfs { /// - /// Description of OneDriveDestination. + /// This is the TFS destination /// [Destination("Tfs")] public class TfsDestination : AbstractDestination @@ -54,6 +54,17 @@ namespace Greenshot.Addon.Tfs private readonly ExportNotification _exportNotification; private readonly WorkItem _workItem; + /// + /// DI constructor + /// + /// ICoreConfiguration + /// IGreenshotLanguage + /// ITfsConfiguration + /// ITfsLanguage + /// TfsClient + /// Func to create please wait forms + /// IResourceProvider + /// ExportNotification public TfsDestination( ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, @@ -72,6 +83,18 @@ namespace Greenshot.Addon.Tfs _exportNotification = exportNotification; } + /// + /// DI constructor + /// + /// ICoreConfiguration + /// IGreenshotLanguage + /// ITfsConfiguration + /// ITfsLanguage + /// TfsClient + /// Func to create please wait forms + /// IResourceProvider + /// ExportNotification + /// WorkItem which is exported to protected TfsDestination( ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, @@ -86,12 +109,16 @@ namespace Greenshot.Addon.Tfs _workItem = workItem; } + /// public override bool IsActive => base.IsActive && _tfsClient.CanUpdate; + /// public override bool UseDynamicsOnly => true; + /// public override bool IsDynamic => true; + /// protected override async Task PrepareDynamicDestinations(ToolStripMenuItem destinationToolStripMenuItem) { if (!destinationToolStripMenuItem.HasDropDownItems) @@ -103,19 +130,21 @@ namespace Greenshot.Addon.Tfs } } + /// public override IEnumerable 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); } } + /// public override string Description { get @@ -130,6 +159,7 @@ namespace Greenshot.Addon.Tfs } } + /// public override IBitmapWithNativeSupport DisplayIcon { get @@ -142,6 +172,7 @@ namespace Greenshot.Addon.Tfs } } + /// public override async Task ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { if (_workItem == null) diff --git a/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs b/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs index 9423228d3..4609b0a45 100644 --- a/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs +++ b/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs @@ -27,23 +27,46 @@ using Greenshot.Addons.ViewModels; namespace Greenshot.Addon.Tfs.ViewModels { + /// + /// This is the view model for the TFS add-on configuration + /// public sealed class TfsConfigViewModel : SimpleConfigScreen { /// /// Here all disposables are registered, so we can clean the up /// private CompositeDisposable _disposables; - - public ITfsConfiguration TfsConfiguration { get; } - - public ITfsLanguage TfsLanguage { get; } - - public IGreenshotLanguage GreenshotLanguage { get; } - - public TfsClient TfsClient { get; } + /// + /// Supply the ITfsConfiguration to the view + /// + public ITfsConfiguration TfsConfiguration { get; } + + /// + /// Supply the ITfsLanguage (translations) to the view + /// + public ITfsLanguage TfsLanguage { get; } + + /// + /// Supply the IGreenshotLanguage (translations) to the view + /// + public IGreenshotLanguage GreenshotLanguage { get; } + + private TfsClient TfsClient { get; } + + /// + /// Supply the FileConfigPartViewModel to the view, which is used as a component + /// public FileConfigPartViewModel FileConfigPartViewModel { get; } + /// + /// DI constructor + /// + /// ITfsConfiguration + /// ITfsLanguage + /// IGreenshotLanguage + /// TfsClient + /// FileConfigPartViewModel public TfsConfigViewModel( ITfsConfiguration tfsConfiguration, ITfsLanguage tfsLanguage, @@ -57,6 +80,8 @@ namespace Greenshot.Addon.Tfs.ViewModels TfsClient = tfsClient; FileConfigPartViewModel = fileConfigPartViewModel; } + + /// public override void Initialize(IConfig config) { FileConfigPartViewModel.DestinationFileConfiguration = TfsConfiguration; @@ -77,6 +102,7 @@ namespace Greenshot.Addon.Tfs.ViewModels base.Initialize(config); } + /// protected override void OnDeactivate(bool close) { var ignoreTask = TfsClient.UpdateWorkItems(); diff --git a/src/Greenshot.Addons/Components/DestinationHolder.cs b/src/Greenshot.Addons/Components/DestinationHolder.cs index 7a6ec1f7b..93973d942 100644 --- a/src/Greenshot.Addons/Components/DestinationHolder.cs +++ b/src/Greenshot.Addons/Components/DestinationHolder.cs @@ -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 . + +using System; using System.Collections.Generic; using System.Linq; @@ -12,8 +31,16 @@ namespace Greenshot.Addons.Components private readonly IEnumerable> _destinations; private readonly IEnumerable _destinationProviders; + /// + /// This is the Instance of the DestinationHolder, used for some cases where DI doesn't work + /// public static DestinationHolder Instance { get; internal set; } + /// + /// DI constructor + /// + /// IEnumerable with lazy IDestination + /// IEnumerable with IDestinationProvider public DestinationHolder( IEnumerable> destinations, IEnumerable destinationProviders diff --git a/src/Greenshot.Addons/Components/ExportNotification.cs b/src/Greenshot.Addons/Components/ExportNotification.cs index 31f34b359..ea121ecdd 100644 --- a/src/Greenshot.Addons/Components/ExportNotification.cs +++ b/src/Greenshot.Addons/Components/ExportNotification.cs @@ -39,7 +39,7 @@ namespace Greenshot.Addons.Components private readonly Func> _toastFactory; /// - /// DI Constructor + /// DI constructor /// /// ICoreConfiguration /// IEventAggregator diff --git a/src/Greenshot.Addons/Controls/ContextMenuToolStripProfessionalRenderer.cs b/src/Greenshot.Addons/Controls/ContextMenuToolStripProfessionalRenderer.cs index c5bd8dd7c..5dbadb67d 100644 --- a/src/Greenshot.Addons/Controls/ContextMenuToolStripProfessionalRenderer.cs +++ b/src/Greenshot.Addons/Controls/ContextMenuToolStripProfessionalRenderer.cs @@ -32,6 +32,10 @@ namespace Greenshot.Addons.Controls { private readonly ICoreConfiguration _coreConfiguration; + /// + /// DI constructor + /// + /// 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) + + /// + protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) { if (_scaledCheckbox == null || (NativeSize)_scaledCheckbox.Size != _coreConfiguration.IconSize) { diff --git a/src/Greenshot.Addons/Controls/GreenshotComboBox.cs b/src/Greenshot.Addons/Controls/GreenshotComboBox.cs index ad907300f..588a5870b 100644 --- a/src/Greenshot.Addons/Controls/GreenshotComboBox.cs +++ b/src/Greenshot.Addons/Controls/GreenshotComboBox.cs @@ -34,23 +34,33 @@ namespace Greenshot.Addons.Controls private Type _enumType; private Enum _selectedEnum; + /// + /// Default constructor + /// + /// public GreenshotComboBox(ILanguage language) { _language = language; SelectedIndexChanged += (sender, args) => StoreSelectedEnum(); } - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue("Core")] [Description("Specifies the Ini-Section to map this control with.")] public string SectionName { get; set; } = "Core"; - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue(null)] [Description("Specifies the property name to map the configuration.")] public string PropertyName { get; set; } - public void SetValue(Enum currentValue) + /// + /// Set the value + /// + /// Enum + public void SetValue(Enum currentValue) { if (currentValue == null) { @@ -71,7 +81,7 @@ namespace Greenshot.Addons.Controls } /// - /// This is a method to popululate the ComboBox + /// This is a method to populate the ComboBox /// with the items from the enumeration /// /// TEnum to populate with diff --git a/src/Greenshot.Addons/Controls/GreenshotLabel.cs b/src/Greenshot.Addons/Controls/GreenshotLabel.cs index ee4747e4a..280881ec4 100644 --- a/src/Greenshot.Addons/Controls/GreenshotLabel.cs +++ b/src/Greenshot.Addons/Controls/GreenshotLabel.cs @@ -22,9 +22,13 @@ using System.Windows.Forms; namespace Greenshot.Addons.Controls { - public class GreenshotLabel : Label, IGreenshotLanguageBindable + /// + /// This is a System.Windows.Forms which has a language key for the translation + /// + public class GreenshotLabel : Label, IGreenshotLanguageBindable { - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue(null)] [Description("Specifies key of the language file to use when displaying the text.")] public string LanguageKey { get; set; } diff --git a/src/Greenshot.Addons/Controls/GreenshotRadioButton.cs b/src/Greenshot.Addons/Controls/GreenshotRadioButton.cs index ce4261a37..f5aac0b13 100644 --- a/src/Greenshot.Addons/Controls/GreenshotRadioButton.cs +++ b/src/Greenshot.Addons/Controls/GreenshotRadioButton.cs @@ -22,22 +22,25 @@ using System.Windows.Forms; namespace Greenshot.Addons.Controls { - /// - /// Description of GreenshotCheckbox. - /// - public class GreenshotRadioButton : RadioButton, IGreenshotLanguageBindable, IGreenshotConfigBindable + /// + /// GreenshotRadioButton allow to work on a configuration and have translations + /// + public class GreenshotRadioButton : RadioButton, IGreenshotLanguageBindable, IGreenshotConfigBindable { - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue("Core")] [Description("Specifies the Ini-Section to map this control with.")] public string SectionName { get; set; } = "Core"; - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue(null)] [Description("Specifies the property name to map the configuration.")] public string PropertyName { get; set; } - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue(null)] [Description("Specifies key of the language file to use when displaying the text.")] public string LanguageKey { get; set; } diff --git a/src/Greenshot.Addons/Controls/GreenshotTextBox.cs b/src/Greenshot.Addons/Controls/GreenshotTextBox.cs index bc810c0f3..df3fa7107 100644 --- a/src/Greenshot.Addons/Controls/GreenshotTextBox.cs +++ b/src/Greenshot.Addons/Controls/GreenshotTextBox.cs @@ -22,14 +22,19 @@ using System.Windows.Forms; namespace Greenshot.Addons.Controls { + /// + /// A text box which reads / writes to the configuration + /// public class GreenshotTextBox : TextBox, IGreenshotConfigBindable { - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue("Core")] [Description("Specifies the Ini-Section to map this control with.")] public string SectionName { get; set; } = "Core"; - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue(null)] [Description("Specifies the property name to map the configuration.")] public string PropertyName { get; set; } diff --git a/src/Greenshot.Addons/Controls/GreenshotToolDropDownButton.cs b/src/Greenshot.Addons/Controls/GreenshotToolDropDownButton.cs index 0823de13d..39dd7ad7f 100644 --- a/src/Greenshot.Addons/Controls/GreenshotToolDropDownButton.cs +++ b/src/Greenshot.Addons/Controls/GreenshotToolDropDownButton.cs @@ -22,9 +22,13 @@ using System.Windows.Forms; namespace Greenshot.Addons.Controls { + /// + /// This is a tool-strip dropdown button which has a translation + /// public class GreenshotToolStripDropDownButton : ToolStripDropDownButton, IGreenshotLanguageBindable { - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue(null)] [Description("Specifies key of the language file to use when displaying the text.")] public string LanguageKey { get; set; } diff --git a/src/Greenshot.Addons/Controls/GreenshotToolStripButton.cs b/src/Greenshot.Addons/Controls/GreenshotToolStripButton.cs index fb256eaf4..c4a57ce4e 100644 --- a/src/Greenshot.Addons/Controls/GreenshotToolStripButton.cs +++ b/src/Greenshot.Addons/Controls/GreenshotToolStripButton.cs @@ -22,9 +22,13 @@ using System.Windows.Forms; namespace Greenshot.Addons.Controls { + /// + /// This is a tool-strip button with translations + /// public class GreenshotToolStripButton : ToolStripButton, IGreenshotLanguageBindable { - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue(null)] [Description("Specifies key of the language file to use when displaying the text.")] public string LanguageKey { get; set; } diff --git a/src/Greenshot.Addons/Controls/GreenshotToolStripLabel.cs b/src/Greenshot.Addons/Controls/GreenshotToolStripLabel.cs index 12727c692..d3a645d38 100644 --- a/src/Greenshot.Addons/Controls/GreenshotToolStripLabel.cs +++ b/src/Greenshot.Addons/Controls/GreenshotToolStripLabel.cs @@ -22,9 +22,13 @@ using System.Windows.Forms; namespace Greenshot.Addons.Controls { + /// + /// this is a tool-strip label with translations + /// public class GreenshotToolStripLabel : ToolStripLabel, IGreenshotLanguageBindable { - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue(null)] [Description("Specifies key of the language file to use when displaying the text.")] public string LanguageKey { get; set; } diff --git a/src/Greenshot.Addons/Controls/GreenshotToolStripMenuItem.cs b/src/Greenshot.Addons/Controls/GreenshotToolStripMenuItem.cs index 576e8df68..91f9ac909 100644 --- a/src/Greenshot.Addons/Controls/GreenshotToolStripMenuItem.cs +++ b/src/Greenshot.Addons/Controls/GreenshotToolStripMenuItem.cs @@ -22,9 +22,13 @@ using System.Windows.Forms; namespace Greenshot.Addons.Controls { + /// + /// This is a tool-strip menu item with translations + /// public class GreenshotToolStripMenuItem : ToolStripMenuItem, IGreenshotLanguageBindable { - [Category("Greenshot")] + /// + [Category("Greenshot")] [DefaultValue(null)] [Description("Specifies key of the language file to use when displaying the text.")] public string LanguageKey { get; set; } diff --git a/src/Greenshot.Addons/Controls/HotkeyControl.cs b/src/Greenshot.Addons/Controls/HotkeyControl.cs index 6a71e68e0..6828d5560 100644 --- a/src/Greenshot.Addons/Controls/HotkeyControl.cs +++ b/src/Greenshot.Addons/Controls/HotkeyControl.cs @@ -37,14 +37,36 @@ namespace Greenshot.Addons.Controls /// public sealed class HotkeyControl : GreenshotTextBox { + /// + /// Modifiers are the additional keys which are pressed together with the "key", like ctrl or shift. + /// [SuppressMessage("ReSharper", "InconsistentNaming")] + [Flags] public enum Modifiers : uint { + /// + /// no modifier is pressed + /// NONE = 0, + /// + /// The alt key is pressed + /// ALT = 1, + /// + /// The ctrl key is pressed + /// CTRL = 2, + /// + /// The shift key is pressed + /// SHIFT = 4, + /// + /// The win key is pressed + /// WIN = 8, + /// + /// When registering hotkeys, this can be specified to prevent repeating keys + /// NO_REPEAT = 0x4000 } @@ -364,11 +386,17 @@ namespace Greenshot.Addons.Controls Text = HotkeyToLocalizedString(_modifiers, _hotkey); } - public override string ToString() + /// + public override string ToString() { return HotkeyToString(HotkeyModifiers, Hotkey); } + /// + /// Get a localized version, for displaying, of a hotkey string + /// + /// + /// 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) + /// + /// Create a string representation from a hotkey + /// + /// Keys + /// Keys + /// string + public static string HotkeyToString(Keys modifierKeyCode, Keys virtualKeyCode) { return HotkeyModifiersToString(modifierKeyCode) + virtualKeyCode; } - public static string HotkeyModifiersToString(Keys modifierKeyCode) + /// + /// Create a string representation from modifiers + /// + /// Keys + /// string + 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) + /// + /// Get a localized version, for displaying, of a hotkey + /// + /// Keys + /// Keys + /// string + public static string HotkeyToLocalizedString(Keys modifierKeyCode, Keys virtualKeyCode) { return HotkeyModifiersToLocalizedString(modifierKeyCode) + GetKeyName(virtualKeyCode); } - public static string HotkeyModifiersToLocalizedString(Keys modifierKeyCode) + /// + /// Get a localized version, for displaying, of modifiers + /// + /// Keys + /// string + 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) + /// + /// Create modifiers from a string + /// + /// string + /// Keys + 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) + /// + /// Create hotkey from a string + /// + /// string + /// Keys + 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); - } - /// /// Register a hotkey /// @@ -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); - } - } - /// /// Handle WndProc messages for the hotkey /// @@ -579,7 +600,12 @@ namespace Greenshot.Addons.Controls return true; } - public static string GetKeyName(Keys givenKey) + /// + /// Get the key name + /// + /// Keys + /// string + public static string GetKeyName(Keys givenKey) { var keyName = new StringBuilder(); const uint numpad = 55; diff --git a/src/Greenshot.Addons/Controls/IGreenshotConfigBindable.cs b/src/Greenshot.Addons/Controls/IGreenshotConfigBindable.cs index 84d96fa04..1ca09d7c0 100644 --- a/src/Greenshot.Addons/Controls/IGreenshotConfigBindable.cs +++ b/src/Greenshot.Addons/Controls/IGreenshotConfigBindable.cs @@ -19,6 +19,9 @@ namespace Greenshot.Addons.Controls { + /// + /// Specifies that a control can be bound to a configuration value + /// public interface IGreenshotConfigBindable { /// diff --git a/src/Greenshot.Addons/Controls/InvertedBooleanConverter.cs b/src/Greenshot.Addons/Controls/InvertedBooleanConverter.cs index cbdb218f8..07120c39e 100644 --- a/src/Greenshot.Addons/Controls/InvertedBooleanConverter.cs +++ b/src/Greenshot.Addons/Controls/InvertedBooleanConverter.cs @@ -23,14 +23,18 @@ using System.Windows.Data; namespace Greenshot.Addons.Controls { + /// + /// This is a boolean converter for WPF which allows to invert the value (true -> false and false -> true) + /// public class InvertedBooleanConverter : IValueConverter { + /// public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return !(bool)(value ?? false); - } + /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return !(bool)(value ?? false); diff --git a/src/Greenshot.Addons/Controls/MovableShowColorForm.cs b/src/Greenshot.Addons/Controls/MovableShowColorForm.cs index ac5f9399c..7dbe10d0b 100644 --- a/src/Greenshot.Addons/Controls/MovableShowColorForm.cs +++ b/src/Greenshot.Addons/Controls/MovableShowColorForm.cs @@ -31,11 +31,17 @@ namespace Greenshot.Addons.Controls /// public partial class MovableShowColorForm : Form { + /// + /// Default constructor for a control + /// public MovableShowColorForm() { InitializeComponent(); } + /// + /// The color under the cursor + /// public Color ColorUnderCursor => preview.BackColor; /// diff --git a/src/Greenshot.Addons/Controls/PleaseWaitForm.cs b/src/Greenshot.Addons/Controls/PleaseWaitForm.cs index 14f5f141c..f75b03e05 100644 --- a/src/Greenshot.Addons/Controls/PleaseWaitForm.cs +++ b/src/Greenshot.Addons/Controls/PleaseWaitForm.cs @@ -43,7 +43,7 @@ namespace Greenshot.Addons.Controls private Thread _waitFor; /// - /// DI Constructor + /// DI constructor /// /// IGreenshotLanguage public PleaseWaitForm(IGreenshotLanguage greenshotLanguage) @@ -57,7 +57,7 @@ namespace Greenshot.Addons.Controls } /// - /// DI Constructor + /// DI constructor /// /// IGreenshotLanguage /// CancellationTokenSource diff --git a/src/Greenshot.Addons/Controls/QualityDialog.cs b/src/Greenshot.Addons/Controls/QualityDialog.cs index 83dd6e7c5..9489aa8c4 100644 --- a/src/Greenshot.Addons/Controls/QualityDialog.cs +++ b/src/Greenshot.Addons/Controls/QualityDialog.cs @@ -25,13 +25,19 @@ using Greenshot.Core.Enums; namespace Greenshot.Addons.Controls { /// - /// Description of JpegQualityDialog. + /// This is a dialog where the user can specify the quality of the written bitmap /// public partial class QualityDialog : GreenshotForm { private readonly ICoreConfiguration _coreConfiguration; - public QualityDialog( + /// + /// DI constructor + /// + /// SurfaceOutputSettings + /// ICoreConfiguration + /// IGreenshotLanguage + 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; } + /// + /// This SurfaceOutputSettings which result from this form + /// + public SurfaceOutputSettings Settings { get; set; } private void Button_okClick(object sender, EventArgs e) { diff --git a/src/Greenshot.Addons/Controls/SaveImageFileDialog.cs b/src/Greenshot.Addons/Controls/SaveImageFileDialog.cs index 1315ac11a..9dbe5db3d 100644 --- a/src/Greenshot.Addons/Controls/SaveImageFileDialog.cs +++ b/src/Greenshot.Addons/Controls/SaveImageFileDialog.cs @@ -41,7 +41,7 @@ namespace Greenshot.Addons.Controls private SaveFileDialog SaveFileDialog; /// - /// DI Constructor + /// DI constructor /// /// ICoreConfiguration /// ICaptureDetails diff --git a/src/Greenshot.Addons/Controls/ThumbnailForm.cs b/src/Greenshot.Addons/Controls/ThumbnailForm.cs index 318e4d26f..41695ff01 100644 --- a/src/Greenshot.Addons/Controls/ThumbnailForm.cs +++ b/src/Greenshot.Addons/Controls/ThumbnailForm.cs @@ -63,6 +63,9 @@ namespace Greenshot.Addons.Controls FormClosing += (sender, args) => UnregisterThumbnail(); } + /// + /// Hide the thumbnail form + /// public new void Hide() { UnregisterThumbnail(); diff --git a/src/Greenshot.Addons/Core/AbstractDestination.cs b/src/Greenshot.Addons/Core/AbstractDestination.cs index 229458a61..f7dc0d337 100644 --- a/src/Greenshot.Addons/Core/AbstractDestination.cs +++ b/src/Greenshot.Addons/Core/AbstractDestination.cs @@ -40,15 +40,27 @@ using Greenshot.Gfx; namespace Greenshot.Addons.Core { /// - /// Description of AbstractDestination. + /// This is the basic implementation of the IDestination /// public abstract class AbstractDestination : IDestination { private static readonly LogSource Log = new LogSource(); + /// + /// Provide the IGreenshotLanguage to the destination + /// protected IGreenshotLanguage GreenshotLanguage { get; } + + /// + /// Provide the ICoreConfiguration to the destination + /// protected ICoreConfiguration CoreConfiguration { get; } + /// + /// DI constructor + /// + /// ICoreConfiguration + /// IGreenshotLanguage protected AbstractDestination( ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage) @@ -70,13 +82,16 @@ namespace Greenshot.Addons.Core /// public virtual BitmapSource DisplayIconWpf => DisplayIcon?.NativeBitmap.ToBitmapSource() ?? GetDisplayIcon(DpiHandler.DefaultScreenDpi).NativeBitmap.ToBitmapSource(); + /// public virtual IBitmapWithNativeSupport GetDisplayIcon(double dpi) { return DisplayIcon; } + /// public virtual bool HasDisplayIcon => true; + /// public virtual Keys EditorShortcutKeys => Keys.None; /// @@ -108,6 +123,7 @@ namespace Greenshot.Addons.Core return Task.CompletedTask; } + /// public void Dispose() { Dispose(true); @@ -125,32 +141,26 @@ namespace Greenshot.Addons.Core /// public virtual bool IsActive => true; + /// + /// This is a replacement of the ExportCaptureAsync + /// + /// bool + /// ISurface + /// ICaptureDetails + /// ExportInformation protected virtual ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { return null; } - /// - /// This is the Async version of the export Capture, and by default it calls the ExportCapture. - /// - /// - /// - /// - /// + /// public virtual Task ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var syncResult = ExportCapture(manuallyInitiated, surface, captureDetails); return Task.FromResult(syncResult); } - /// - /// Return a menu item - /// - /// bool is dynamic entries need to be added - /// ContextMenuStrip - /// EventHandler - /// BitmapScaleHandler - /// ToolStripMenuItem + /// public virtual ToolStripMenuItem GetMenuItem(bool addDynamics, ContextMenuStrip menu, EventHandler destinationClickHandler, BitmapScaleHandler bitmapScaleHandler) { var basisMenuItem = new ToolStripMenuItem(Description) @@ -222,11 +232,16 @@ namespace Greenshot.Addons.Core return basisMenuItem; } + /// + /// Override this to have your disposed called + /// + /// protected virtual void Dispose(bool disposing) { //if (disposing) {} } + /// public override string ToString() { return Description; diff --git a/src/Greenshot.Addons/Core/AbstractProcessor.cs b/src/Greenshot.Addons/Core/AbstractProcessor.cs index 5e4e2e1b4..232218a9c 100644 --- a/src/Greenshot.Addons/Core/AbstractProcessor.cs +++ b/src/Greenshot.Addons/Core/AbstractProcessor.cs @@ -21,12 +21,13 @@ using Greenshot.Addons.Interfaces; namespace Greenshot.Addons.Core { - /// - /// Description of AbstractProcessor. - /// - public abstract class AbstractProcessor : IProcessor + /// + /// This implements a basic IProcessor + /// + public abstract class AbstractProcessor : IProcessor { - public virtual int CompareTo(object obj) + /// + public virtual int CompareTo(object obj) { if (!(obj is IProcessor other)) { @@ -39,21 +40,31 @@ namespace Greenshot.Addons.Core return Priority - other.Priority; } - public abstract string Designation { get; } + /// + public abstract string Designation { get; } - public abstract string Description { get; } + /// + public abstract string Description { get; } - public virtual int Priority => 10; + /// + public virtual int Priority => 10; - public void Dispose() + /// + public void Dispose() { Dispose(true); } - public virtual bool IsActive => true; + /// + public virtual bool IsActive => true; - public abstract bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails); + /// + public abstract bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails); + /// + /// Override this to have dispose functionality + /// + /// protected virtual void Dispose(bool disposing) { //if (disposing) {} diff --git a/src/Greenshot.Addons/Core/Capture.cs b/src/Greenshot.Addons/Core/Capture.cs index ead99d280..52558a8be 100644 --- a/src/Greenshot.Addons/Core/Capture.cs +++ b/src/Greenshot.Addons/Core/Capture.cs @@ -119,7 +119,8 @@ namespace Greenshot.Addons.Core } } - public void NullBitmap() + /// + public void NullBitmap() { _bitmap = null; } diff --git a/src/Greenshot.Addons/Core/Credentials/CredUIReturnCodes.cs b/src/Greenshot.Addons/Core/Credentials/CredUIReturnCodes.cs index e5740fcec..a46736d53 100644 --- a/src/Greenshot.Addons/Core/Credentials/CredUIReturnCodes.cs +++ b/src/Greenshot.Addons/Core/Credentials/CredUIReturnCodes.cs @@ -17,6 +17,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#pragma warning disable 1591 namespace Greenshot.Addons.Core.Credentials { /// http://www.pinvoke.net/default.aspx/Enums.CredUIReturnCodes diff --git a/src/Greenshot.Addons/Core/Credentials/CredUiInfo.cs b/src/Greenshot.Addons/Core/Credentials/CredUiInfo.cs index ffa90f3a6..121c50f19 100644 --- a/src/Greenshot.Addons/Core/Credentials/CredUiInfo.cs +++ b/src/Greenshot.Addons/Core/Credentials/CredUiInfo.cs @@ -19,6 +19,7 @@ using System; using System.Runtime.InteropServices; +#pragma warning disable 1591 namespace Greenshot.Addons.Core.Credentials { diff --git a/src/Greenshot.Addons/Core/DisplayKeyAttribute.cs b/src/Greenshot.Addons/Core/DisplayKeyAttribute.cs deleted file mode 100644 index 230d69d6f..000000000 --- a/src/Greenshot.Addons/Core/DisplayKeyAttribute.cs +++ /dev/null @@ -1,38 +0,0 @@ -// 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 . - -using System; - -namespace Greenshot.Addons.Core -{ - [AttributeUsage(AttributeTargets.Field)] - public sealed class DisplayKeyAttribute : Attribute - { - public DisplayKeyAttribute(string v) - { - Value = v; - } - - public DisplayKeyAttribute() - { - } - - public string Value { get; } - } -} \ No newline at end of file diff --git a/src/Greenshot.Addons/Core/EmailConfigHelper.cs b/src/Greenshot.Addons/Core/EmailConfigHelper.cs index a478e1e81..2abaa5ba4 100644 --- a/src/Greenshot.Addons/Core/EmailConfigHelper.cs +++ b/src/Greenshot.Addons/Core/EmailConfigHelper.cs @@ -23,7 +23,7 @@ using Microsoft.Win32; namespace Greenshot.Addons.Core { /// - /// Description of EmailConfigHelper. + /// Contains some helper functionality for MAPI /// public static class EmailConfigHelper { @@ -32,6 +32,10 @@ namespace Greenshot.Addons.Core private const string MapiLocationKey = @"SOFTWARE\Microsoft\Windows Messaging Subsystem"; private const string MapiKey = @"MAPI"; + /// + /// Retrieve the name of the installed MAPI client + /// + /// public static string GetMapiClient() { using (var key = Registry.CurrentUser.OpenSubKey(MapiClientKey, false)) @@ -47,7 +51,11 @@ namespace Greenshot.Addons.Core } } - public static bool HasMapi() + /// + /// Check if a MAPI client is installed + /// + /// bool + public static bool HasMapi() { using (var key = Registry.LocalMachine.OpenSubKey(MapiLocationKey, false)) { @@ -55,7 +63,11 @@ namespace Greenshot.Addons.Core } } - public static string GetOutlookExePath() + /// + /// Get the path of Outlook from the registry + /// + /// string + public static string GetOutlookExePath() { using (var key = Registry.LocalMachine.OpenSubKey(OutlookPathKey, false)) { diff --git a/src/Greenshot.Addons/Core/EnumExtensions.cs b/src/Greenshot.Addons/Core/EnumExtensions.cs index 21d3bd0e3..b04e8081b 100644 --- a/src/Greenshot.Addons/Core/EnumExtensions.cs +++ b/src/Greenshot.Addons/Core/EnumExtensions.cs @@ -21,9 +21,19 @@ using System; namespace Greenshot.Addons.Core { + /// + /// Extensions for helping with enumerations + /// public static class EnumerationExtensions { - public static bool Has(this Enum type, T value) + /// + /// Check if a value is in an enum + /// + /// + /// + /// + /// bool + public static bool Has(this Enum type, T value) { var underlyingType = Enum.GetUnderlyingType(value.GetType()); try diff --git a/src/Greenshot.Addons/Core/Enums/ConfigTags.cs b/src/Greenshot.Addons/Core/Enums/ConfigTags.cs index a02e4f984..084c71a91 100644 --- a/src/Greenshot.Addons/Core/Enums/ConfigTags.cs +++ b/src/Greenshot.Addons/Core/Enums/ConfigTags.cs @@ -2,6 +2,9 @@ { public enum ConfigTags { + /// + /// Tag that the configuration can have a language key. + /// LanguageKey } } diff --git a/src/Greenshot.Addons/Core/EventDelay.cs b/src/Greenshot.Addons/Core/EventDelay.cs index 0400f6d47..9511025a7 100644 --- a/src/Greenshot.Addons/Core/EventDelay.cs +++ b/src/Greenshot.Addons/Core/EventDelay.cs @@ -21,23 +21,34 @@ using System; namespace Greenshot.Addons.Core { + /// + /// A helper to delay events for hotkeys in Windows 7 + /// public class EventDelay { - private readonly long waitTime; - private long lastCheck; + private readonly long _waitTime; + private long _lastCheck; + /// + /// Default constructor + /// + /// public EventDelay(long ticks) { - waitTime = ticks; - } - - public bool Check() + _waitTime = ticks; + } + + /// + /// Can we handle the next event + /// + /// bool + public bool Check() { lock (this) { var now = DateTime.Now.Ticks; - var isPassed = now - lastCheck > waitTime; - lastCheck = now; + var isPassed = now - _lastCheck > _waitTime; + _lastCheck = now; return isPassed; } } diff --git a/src/Greenshot.Addons/Core/ExtensionAttribute.cs b/src/Greenshot.Addons/Core/ExtensionAttribute.cs deleted file mode 100644 index 7ca370e27..000000000 --- a/src/Greenshot.Addons/Core/ExtensionAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -// 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 . - -using System; - -namespace Greenshot.Addons.Core -{ - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] - public sealed class ExtensionAttribute : Attribute - { - } -} \ No newline at end of file diff --git a/src/Greenshot.Addons/Core/FilenameHelper.cs b/src/Greenshot.Addons/Core/FilenameHelper.cs index 5d51f8e5d..e7015acee 100644 --- a/src/Greenshot.Addons/Core/FilenameHelper.cs +++ b/src/Greenshot.Addons/Core/FilenameHelper.cs @@ -29,6 +29,9 @@ using Greenshot.Core.Enums; namespace Greenshot.Addons.Core { + /// + /// Code for handling filenames, with patterns etc + /// public static class FilenameHelper { private const int MaxTitleLength = 80; @@ -98,22 +101,25 @@ namespace Greenshot.Addons.Core return path; } - public static string GetFilenameWithoutExtensionFromPattern(string pattern) - { - return GetFilenameWithoutExtensionFromPattern(pattern, null); - } - - public static string GetFilenameWithoutExtensionFromPattern(string pattern, ICaptureDetails captureDetails) + /// + /// Create a filename without extension for the pattern based upon the specified details + /// + /// string + /// ICaptureDetails + /// string with filename + public static string GetFilenameWithoutExtensionFromPattern(string pattern, ICaptureDetails captureDetails) { return FillPattern(pattern, captureDetails, true); } - public static string GetFilenameFromPattern(string pattern, OutputFormats imageFormat) - { - return GetFilenameFromPattern(pattern, imageFormat, null); - } - - public static string GetFilenameFromPattern(string pattern, OutputFormats imageFormat, ICaptureDetails captureDetails) + /// + /// Create a filename for the pattern based upon the specified details + /// + /// string + /// OutputFormats + /// ICaptureDetails + /// string with filename + public static string GetFilenameFromPattern(string pattern, OutputFormats imageFormat, ICaptureDetails captureDetails) { return FillPattern(pattern, captureDetails, true) + "." + imageFormat.ToString().ToLower(); } diff --git a/src/Greenshot.Addons/Core/IDestinationFileConfiguration.cs b/src/Greenshot.Addons/Core/IDestinationFileConfiguration.cs index 80b90c9c6..cd8e760f6 100644 --- a/src/Greenshot.Addons/Core/IDestinationFileConfiguration.cs +++ b/src/Greenshot.Addons/Core/IDestinationFileConfiguration.cs @@ -18,6 +18,7 @@ // along with this program. If not, see . using System.ComponentModel; +#pragma warning disable 1591 namespace Greenshot.Addons.Core { diff --git a/src/Greenshot.Addons/Core/StringExtensions.cs b/src/Greenshot.Addons/Core/StringExtensions.cs deleted file mode 100644 index 1200edfec..000000000 --- a/src/Greenshot.Addons/Core/StringExtensions.cs +++ /dev/null @@ -1,117 +0,0 @@ -// 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 . - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text.RegularExpressions; -using Dapplo.Log; - -namespace Greenshot.Addons.Core -{ - public static class StringExtensions - { - private static readonly LogSource Log = new LogSource(); - - /// - /// Format a string with the specified object - /// - /// String with formatting, like {name} - /// Object used for the formatting - /// Formatted string - public static string FormatWith(this string format, object source) - { - return FormatWith(format, null, source); - } - - /// - /// Format the string "format" with the source - /// - /// - /// - /// - /// object with properties, if a property has the type IDictionary string,string it can used these - /// parameters too - /// - /// Formatted string - public static string FormatWith(this string format, IFormatProvider provider, object source) - { - if (format == null) - { - throw new ArgumentNullException(nameof(format)); - } - - IDictionary properties = new Dictionary(); - foreach (var propertyInfo in source.GetType().GetProperties()) - { - if (!propertyInfo.CanRead || !propertyInfo.CanWrite) - { - continue; - } - - var value = propertyInfo.GetValue(source, null); - if (propertyInfo.PropertyType != typeof(IDictionary)) - { - properties.Add(propertyInfo.Name, value); - } - else - { - var dictionary = (IDictionary) value; - foreach (var propertyKey in dictionary.Keys) - { - properties.Add(propertyKey, dictionary[propertyKey]); - } - } - } - - var r = new Regex(@"(?\{)+(?[\w\.\[\]]+)(?:[^}]+)?(?\})+", - RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - - var values = new List(); - var rewrittenFormat = r.Replace(format, m => - { - var startGroup = m.Groups["start"]; - var propertyGroup = m.Groups["property"]; - var formatGroup = m.Groups["format"]; - var endGroup = m.Groups["end"]; - - values.Add(properties.TryGetValue(propertyGroup.Value, out var value) ? value : source); - return new string('{', startGroup.Captures.Count) + (values.Count - 1) + formatGroup.Value + new string('}', endGroup.Captures.Count); - }); - - return string.Format(provider, rewrittenFormat, values.ToArray()); - } - - /// - /// Read "streamextensions" :) - /// - /// Stream - /// Stream - public static void CopyTo(this Stream input, Stream output) - { - var buffer = new byte[16 * 1024]; // Fairly arbitrary size - int bytesRead; - - while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0) - { - output.Write(buffer, 0, bytesRead); - } - } - } -} \ No newline at end of file diff --git a/src/Greenshot.Addons/Extensions/ClipboardHtmlExtensions.cs b/src/Greenshot.Addons/Extensions/ClipboardHtmlExtensions.cs index d464990ab..7f5851950 100644 --- a/src/Greenshot.Addons/Extensions/ClipboardHtmlExtensions.cs +++ b/src/Greenshot.Addons/Extensions/ClipboardHtmlExtensions.cs @@ -29,6 +29,9 @@ using Greenshot.Core.Enums; namespace Greenshot.Addons.Extensions { + /// + /// Extensions for the Clipboard functionality which have to do with HTML + /// public static class ClipboardHtmlExtensions { // Defintion of the Html Clipboard format @@ -132,6 +135,7 @@ EndSelection:<<<<<<<4 /// /// IClipboardAccessToken /// ISurface + /// ICoreConfiguration public static void SetAsHtml(this IClipboardAccessToken clipboardAccessToken, ISurface surface, ICoreConfiguration coreConfiguration) { var pngOutputSettings = new SurfaceOutputSettings(coreConfiguration, OutputFormats.png, 100, false); @@ -148,6 +152,7 @@ EndSelection:<<<<<<<4 /// /// IClipboardAccessToken /// ISurface + /// ICoreConfiguration public static void SetAsEmbeddedHtml(this IClipboardAccessToken clipboardAccessToken, ISurface surface, ICoreConfiguration coreConfiguration) { using (var pngStream = new MemoryStream()) diff --git a/src/Greenshot.Addons/Interfaces/Drawing/Adorners/IAdorner.cs b/src/Greenshot.Addons/Interfaces/Drawing/Adorners/IAdorner.cs index 56c0b9d92..d337c1af9 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/Adorners/IAdorner.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/Adorners/IAdorner.cs @@ -23,6 +23,9 @@ using Dapplo.Windows.Common.Structs; namespace Greenshot.Addons.Interfaces.Drawing.Adorners { + /// + /// Defines an adorner interface + /// public interface IAdorner { /// diff --git a/src/Greenshot.Addons/Interfaces/Drawing/EditStatus.cs b/src/Greenshot.Addons/Interfaces/Drawing/EditStatus.cs index 902710fb4..36c919844 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/EditStatus.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/EditStatus.cs @@ -17,14 +17,18 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#pragma warning disable 1591 namespace Greenshot.Addons.Interfaces.Drawing { + /// + /// The edit status, used to decide how to draw + /// public enum EditStatus { - UNDRAWN, - DRAWING, - MOVING, - RESIZING, - IDLE + Undrawn, + Drawing, + Moving, + Resizing, + Idle } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventArgs.cs b/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventArgs.cs index afc7c2f9d..46bbba00e 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventArgs.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/FieldChangedEventArgs.cs @@ -26,11 +26,18 @@ namespace Greenshot.Addons.Interfaces.Drawing /// public class FieldChangedEventArgs : EventArgs { - public FieldChangedEventArgs(IField field) + /// + /// Constructor for the event args + /// + /// IField + public FieldChangedEventArgs(IField field) { Field = field; } - public IField Field { get; private set; } + /// + /// Field which is changed + /// + public IField Field { get; } } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/FieldFlag.cs b/src/Greenshot.Addons/Interfaces/Drawing/FieldFlag.cs index f3a7970a1..2a56aaedb 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/FieldFlag.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/FieldFlag.cs @@ -21,11 +21,23 @@ using System; namespace Greenshot.Addons.Interfaces.Drawing { + /// + /// Flags for a field, which define a behavior + /// [Flags] public enum FieldFlag { - NONE = 0, - CONFIRMABLE = 1, - COUNTER = 2 + /// + /// No flags + /// + None = 0, + /// + /// This field needs to be confirmed + /// + Confirmable = 1, + /// + /// This field is a counter + /// + Counter = 2 } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IBitmapContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/IBitmapContainer.cs index 07a15e56f..19c39d354 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IBitmapContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IBitmapContainer.cs @@ -26,8 +26,15 @@ namespace Greenshot.Addons.Interfaces.Drawing /// public interface IBitmapContainer : IDrawableContainer { - IBitmapWithNativeSupport Bitmap { get; set; } + /// + /// The actual IBitmap + /// + IBitmapWithNativeSupport Bitmap { get; set; } + /// + /// Load a bitmap into this container + /// + /// string void Load(string filename); } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/ICursorContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/ICursorContainer.cs index 41bc67501..8fac995f8 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/ICursorContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/ICursorContainer.cs @@ -21,10 +21,20 @@ using System.Windows.Forms; namespace Greenshot.Addons.Interfaces.Drawing { + /// + /// Interface for a cursor container + /// public interface ICursorContainer : IDrawableContainer { + /// + /// This is the cursor + /// Cursor Cursor { get; set; } + /// + /// Load a cursor into this container + /// + /// string void Load(string filename); } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainer.cs index 2002c8906..ce1bda623 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainer.cs @@ -28,32 +28,74 @@ using Greenshot.Addons.Interfaces.Drawing.Adorners; namespace Greenshot.Addons.Interfaces.Drawing { + /// + /// This is the interface for the drawable container + /// public interface IDrawableContainer : INotifyPropertyChanged, IDisposable { + /// + /// The surface where this container belongs to + /// ISurface Parent { get; set; } + /// + /// Is this container selected + /// bool Selected { get; set; } + /// + /// Left for the bounds + /// int Left { get; set; } + /// + /// Top for the bounds + /// int Top { get; set; } + /// + /// Width for the bounds + /// int Width { get; set; } + /// + /// Height for the bounds + /// int Height { get; set; } + /// + /// Location for the container + /// NativePoint Location { get; } + /// + /// Size of the container + /// Size Size { get; } + /// + /// The bounds for the container + /// NativeRect Bounds { get; } + /// + /// The drawing bounds for the container + /// NativeRect DrawingBounds { get; } + /// + /// does this container have filters + /// bool HasFilters { get; } + /// + /// The current edit status + /// EditStatus Status { get; set; } + /// + /// Default edit status + /// EditStatus DefaultEditMode { get; } /// @@ -61,16 +103,78 @@ namespace Greenshot.Addons.Interfaces.Drawing /// IList Adorners { get; } + /// + /// Apply new bounds for the container + /// + /// void ApplyBounds(NativeRect newBounds); + + /// + /// Align the container to the parent + /// + /// HorizontalAlignment + /// VerticalAlignment void AlignToParent(HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment); + + /// + /// Invalidate the content under the container + /// void Invalidate(); + + /// + /// Is the container under the mouse coordinates + /// + /// int + /// int + /// bool bool ClickableAt(int x, int y); + + /// + /// Move the container + /// + /// int + /// int void MoveBy(int x, int y); + + /// + /// Transform the container, if possible + /// + /// Matrix void Transform(Matrix matrix); + + /// + /// Handle a mouse down event + /// + /// int + /// int + /// bool bool HandleMouseDown(int x, int y); + + /// + /// Handle a mouse up event + /// + /// int + /// int void HandleMouseUp(int x, int y); - bool HandleMouseMove(int x, int y); + + /// + /// Handle a mouse move event + /// + /// int + /// int + /// bool + bool HandleMouseMove(int x, int y); + + /// + /// Initialize the content + /// + /// bool bool InitContent(); + + /// + /// Make the bound change undoable + /// + /// bool void MakeBoundsChangeUndoable(bool allowMerge); } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainerList.cs b/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainerList.cs index 574c47733..cf29d265b 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainerList.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IDrawableContainerList.cs @@ -27,33 +27,149 @@ using Greenshot.Gfx; namespace Greenshot.Addons.Interfaces.Drawing { + /// + /// This is the interface for a list of containers, it pretty much wraps the container + /// public interface IDrawableContainerList : IList, IDisposable { + /// + /// The ID of the surface + /// Guid ParentID { get; } + /// + /// Is this list selected + /// bool Selected { get; set; } + /// + /// The parent surface to which this container list belongs + /// ISurface Parent { get; set; } + /// + /// Status of the containers + /// EditStatus Status { get; set; } - void MakeBoundsChangeUndoable(bool allowMerge); + /// + /// Make bounds change undoable + /// + /// bool + void MakeBoundsChangeUndoable(bool allowMerge); + + /// + /// Transform all container in the list + /// + /// Matrix void Transform(Matrix matrix); + + /// + /// Move all containers in the list + /// + /// int + /// int void MoveBy(int dx, int dy); + + /// + /// Is a container in the list click-able + /// + /// int + /// int + /// bool ClickableAt(int x, int y); + + /// + /// Get the element in the list which is under the coordinates + /// + /// int + /// int + /// IDrawableContainer IDrawableContainer ClickableElementAt(int x, int y); + + /// + /// Handle the double click + /// void OnDoubleClick(); + + /// + /// Are there any filters used in the specified rectangle + /// + /// NativeRect + /// bool bool HasIntersectingFilters(NativeRect clipRectangle); + + /// + /// Is there an intersection with the specified rectangle + /// + /// NativeRect + /// bool bool IntersectsWith(NativeRect clipRectangle); - void Draw(Graphics g, IBitmapWithNativeSupport bitmap, RenderMode renderMode, NativeRect clipRectangle); + + /// + /// Draw the containers in the list + /// + /// Graphics + /// IBitmapWithNativeSupport + /// RenderMode + /// NativeRect + void Draw(Graphics graphics, IBitmapWithNativeSupport bitmap, RenderMode renderMode, NativeRect clipRectangle); + + /// + /// Invalidate the bound of all the containers in the list + /// void Invalidate(); + + /// + /// Move all the elements in the list to the top + /// + /// void PullElementsToTop(IDrawableContainerList elements); + + /// + /// Can elements be pushed down? + /// + /// IDrawableContainerList + /// bool bool CanPushDown(IDrawableContainerList elements); + + /// + /// Move all the elements in the list up + /// + /// IDrawableContainerList void PullElementsUp(IDrawableContainerList elements); + + /// + /// Can elements be pulled up? + /// + /// IDrawableContainerList + /// bool bool CanPullUp(IDrawableContainerList elements); + + /// + /// Move all the elements in the list down + /// + /// IDrawableContainerList void PushElementsDown(IDrawableContainerList elements); + + /// + /// Move all the elements in the list to the bottom + /// + /// IDrawableContainerList void PushElementsToBottom(IDrawableContainerList elements); + + /// + /// Show a context menu for the elements in the list + /// + /// MouseEventArgs + /// ISurface void ShowContextMenu(MouseEventArgs e, ISurface surface); + + /// + /// Send a field changed event to all the containers + /// + /// + /// void HandleFieldChangedEvent(object sender, FieldChangedEventArgs e); } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IField.cs b/src/Greenshot.Addons/Interfaces/Drawing/IField.cs index 078a74b86..c2b6f5568 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IField.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IField.cs @@ -22,16 +22,28 @@ using System.ComponentModel; namespace Greenshot.Addons.Interfaces.Drawing { /// - /// THs interface for a field + /// The interface for a field /// public interface IField : INotifyPropertyChanged { + /// + /// The field value + /// object Value { get; set; } + /// + /// Field type + /// IFieldType FieldType { get; set; } + /// + /// The scope of the field + /// string Scope { get; set; } + /// + /// Does the field have a value + /// bool HasValue { get; } } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IFieldType.cs b/src/Greenshot.Addons/Interfaces/Drawing/IFieldType.cs index f92e1a16d..11d7fdbda 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IFieldType.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IFieldType.cs @@ -21,10 +21,19 @@ using System; namespace Greenshot.Addons.Interfaces.Drawing { + /// + /// This is the interface which defines a field type + /// public interface IFieldType { + /// + /// Name of the field type + /// string Name { get; } + /// + /// Type of the field value + /// Type ValueType { get; } } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IFieldholder.cs b/src/Greenshot.Addons/Interfaces/Drawing/IFieldholder.cs index 131815ec5..e9545e72b 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IFieldholder.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IFieldholder.cs @@ -29,13 +29,48 @@ namespace Greenshot.Addons.Interfaces.Drawing /// public interface IFieldHolder { + /// + /// This event is fired when the field changes + /// event FieldChangedEventHandler FieldChanged; - void AddField(IField field); + /// + /// Add a field to the holder + /// + /// IField + void AddField(IField field); + + /// + /// Remove the specified field from this holder + /// + /// void RemoveField(IField field); + + /// + /// Get all the fields + /// + /// IList GetFields(); + + /// + /// Get the field with the specified type + /// + /// IFieldType + /// IField IField GetField(IFieldType fieldType); + + /// + /// Does this holder have a certain field? + /// + /// IFieldType + /// bool bool HasField(IFieldType fieldType); + + /// + /// Set the value for a certain field type + /// + /// IFieldType + /// object void SetFieldValue(IFieldType fieldType, object value); } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IIconContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/IIconContainer.cs index acc7fad45..c9835dfbb 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IIconContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IIconContainer.cs @@ -21,10 +21,20 @@ using System.Drawing; namespace Greenshot.Addons.Interfaces.Drawing { + /// + /// The interface for an icon container + /// public interface IIconContainer : IDrawableContainer { + /// + /// The actual icon for the container + /// Icon Icon { get; set; } + /// + /// Load an icon from a file into this container + /// + /// string void Load(string filename); } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/IMetafileContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/IMetafileContainer.cs index f387dbd60..5366c87ec 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/IMetafileContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/IMetafileContainer.cs @@ -21,10 +21,21 @@ using System.Drawing.Imaging; namespace Greenshot.Addons.Interfaces.Drawing { + /// + /// This is the interface for a meta-file container (wmf) + /// This is obsolete?? + /// public interface IMetafileContainer : IDrawableContainer { + /// + /// The actual meta file + /// Metafile Metafile { get; set; } + /// + /// Load a meta file into this container + /// + /// void Load(string filename); } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Drawing/ITextContainer.cs b/src/Greenshot.Addons/Interfaces/Drawing/ITextContainer.cs index 051fc86ee..3b339728e 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/ITextContainer.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/ITextContainer.cs @@ -19,10 +19,19 @@ namespace Greenshot.Addons.Interfaces.Drawing { + /// + /// This is the interface for a text container + /// public interface ITextContainer : IDrawableContainer { + /// + /// The actual text to display + /// string Text { get; set; } + /// + /// Fit the container to the text + /// void FitToText(); } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/ExportInformation.cs b/src/Greenshot.Addons/Interfaces/ExportInformation.cs index 42767af6e..67637cd31 100644 --- a/src/Greenshot.Addons/Interfaces/ExportInformation.cs +++ b/src/Greenshot.Addons/Interfaces/ExportInformation.cs @@ -19,27 +19,61 @@ namespace Greenshot.Addons.Interfaces { + /// + /// This contains information about an export + /// public class ExportInformation { - public ExportInformation(string destinationDesignation, string destinationDescription) + /// + /// The constructor + /// + /// string + /// string + public ExportInformation(string destinationDesignation, string destinationDescription) { DestinationDesignation = destinationDesignation; DestinationDescription = destinationDescription; } - public ExportInformation(string destinationDesignation, string destinationDescription, bool exportMade) : this(destinationDesignation, destinationDescription) + /// + /// The constructor + /// + /// string + /// string + /// bool + public ExportInformation(string destinationDesignation, string destinationDescription, bool exportMade) : this(destinationDesignation, destinationDescription) { ExportMade = exportMade; } + /// + /// Was there an error in this export? + /// public bool IsError => !string.IsNullOrEmpty(ErrorMessage); + + /// + /// Was there not an error in tthishe export? + /// public bool IsOk => string.IsNullOrEmpty(ErrorMessage); + /// + /// Did we export to file? + /// public bool IsFileExport => !string.IsNullOrEmpty(Filepath); + + /// + /// Did we export to a "cloud" service? + /// public bool IsCloudExport => !string.IsNullOrEmpty(Uri); + /// + /// What is the designation of the destination this was exported to? + /// public string DestinationDesignation { get; } + /// + /// What is the description of the destination + /// public string DestinationDescription { get; set; } /// @@ -47,10 +81,19 @@ namespace Greenshot.Addons.Interfaces /// public bool ExportMade { get; set; } + /// + /// The uri where the export can be found + /// public string Uri { get; set; } + /// + /// The error message when an error occured + /// public string ErrorMessage { get; set; } + /// + /// The path to the file where the export can be found + /// public string Filepath { get; set; } } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Forms/IImageEditor.cs b/src/Greenshot.Addons/Interfaces/Forms/IImageEditor.cs index 114aef284..4bcfad97b 100644 --- a/src/Greenshot.Addons/Interfaces/Forms/IImageEditor.cs +++ b/src/Greenshot.Addons/Interfaces/Forms/IImageEditor.cs @@ -37,6 +37,9 @@ namespace Greenshot.Addons.Interfaces.Forms /// ICaptureDetails CaptureDetails { get; } + /// + /// The surface for this editor + /// ISurface Surface { get; set; } /// diff --git a/src/Greenshot.Addons/Interfaces/ICapture.cs b/src/Greenshot.Addons/Interfaces/ICapture.cs index c559e1738..45b5546d7 100644 --- a/src/Greenshot.Addons/Interfaces/ICapture.cs +++ b/src/Greenshot.Addons/Interfaces/ICapture.cs @@ -29,23 +29,44 @@ namespace Greenshot.Addons.Interfaces /// public interface ICapture : IDisposable { - // The Capture Details - ICaptureDetails CaptureDetails { get; set; } + /// + /// The Capture Details + /// + ICaptureDetails CaptureDetails { get; set; } - // The captured Image + /// + /// The captured Image + /// IBitmapWithNativeSupport Bitmap { get; set; } + /// + /// Bounds of the capture + /// NativeRect ScreenBounds { get; set; } + /// + /// Cursor on the capture + /// Icon Cursor { get; set; } - // Boolean to specify if the cursor is available - bool CursorVisible { get; set; } + /// + /// Boolean to specify if the cursor is available + /// + bool CursorVisible { get; set; } + /// + /// Location of the cursor + /// NativePoint CursorLocation { get; set; } + /// + /// Location of the capture + /// NativePoint Location { get; set; } + /// + /// Clear the capture + /// void NullBitmap(); /// diff --git a/src/Greenshot.Addons/Interfaces/ICaptureDetails.cs b/src/Greenshot.Addons/Interfaces/ICaptureDetails.cs index 31694abb3..11cc3687f 100644 --- a/src/Greenshot.Addons/Interfaces/ICaptureDetails.cs +++ b/src/Greenshot.Addons/Interfaces/ICaptureDetails.cs @@ -23,27 +23,49 @@ using Greenshot.Addons.Components; namespace Greenshot.Addons.Interfaces { - //, Video }; - /// /// Details for the capture, like the window title and date/time etc. /// public interface ICaptureDetails { + /// + /// The filename for the capture + /// string Filename { get; set; } + /// + /// Title of the capture + /// string Title { get; set; } + /// + /// Date and time when the capture was taken + /// DateTime DateTime { get; set; } + /// + /// A list of destinations (TODO: to what end? + /// List CaptureDestinations { get; set; } + /// + /// Meta data for the capture + /// Dictionary MetaData { get; } + /// + /// What mode the capture was taken with + /// CaptureMode CaptureMode { get; set; } + /// + /// DPI-X settings for the capture + /// float DpiX { get; set; } + /// + /// DPI-Y settings for the capture + /// float DpiY { get; set; } /// @@ -53,9 +75,28 @@ namespace Greenshot.Addons.Interfaces /// The value for the meta-data void AddMetaData(string key, string value); + /// + /// Clear all destinations + /// void ClearDestinations(); + + /// + /// Remove a destination + /// + /// void RemoveDestination(IDestination captureDestination); + + /// + /// Add a destination + /// + /// void AddDestination(IDestination captureDestination); + + /// + /// Is a certain destination available? + /// + /// string + /// bool bool HasDestination(string designation); } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/ISurface.cs b/src/Greenshot.Addons/Interfaces/ISurface.cs index 8e6f12baf..4b0dd6a77 100644 --- a/src/Greenshot.Addons/Interfaces/ISurface.cs +++ b/src/Greenshot.Addons/Interfaces/ISurface.cs @@ -42,7 +42,10 @@ namespace Greenshot.Addons.Interfaces /// Guid Id { get; set; } - IDrawableContainerList Elements { get; } + /// + /// All the elements (containers) on the surface + /// + IDrawableContainerList Elements { get; } /// /// Get/Set the image to the Surface @@ -54,23 +57,64 @@ namespace Greenshot.Addons.Interfaces /// IBitmapWithNativeSupport Screenshot { get; set; } + /// + /// Are any elements selected + /// bool HasSelectedElements { get; } + /// + /// Is the surface modified? False if the surface has been exported or saved. + /// bool Modified { get; set; } + /// + /// When the surface is saved, this is the location of the last save + /// string LastSaveFullPath { get; set; } + /// + /// When the surface is uploaded, this is the url for the last upload + /// string UploadUrl { get; set; } + /// + /// Does the surface have a cursor? + /// bool HasCursor { get; } + /// + /// The capture details for the capture which is used by the surface + /// ICaptureDetails CaptureDetails { get; set; } + /// + /// Width of the surface + /// int Width { get; } + + /// + /// Height of the surface + /// int Height { get; } + + /// + /// The size changed event + /// event SurfaceSizeChangeEventHandler SurfaceSizeChanged; + + /// + /// The message event + /// event SurfaceMessageEventHandler SurfaceMessage; + + /// + /// The drawing mode changed event + /// event SurfaceDrawingModeEventHandler DrawingModeChanged; + + /// + /// The moving element changed event + /// event SurfaceElementEventHandler MovingElementChanged; /// @@ -98,20 +142,108 @@ namespace Greenshot.Addons.Interfaces ITextContainer AddTextContainer(string text, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, FontFamily family, float size, bool italic, bool bold, bool shadow, int borderSize, Color color, Color fillColor); - IBitmapContainer AddImageContainer(IBitmapWithNativeSupport bitmap, int x, int y); - ICursorContainer AddCursorContainer(Cursor cursor, int x, int y); + /// + /// Add an image container to the surface at the specified location + /// + /// IBitmapWithNativeSupport + /// int + /// int + /// IBitmapContainer + IBitmapContainer AddImageContainer(IBitmapWithNativeSupport bitmap, int x, int y); + + /// + /// Add a cursor container to the surface at the specified location + /// + /// Cursor + /// int + /// int + /// ICursorContainer + ICursorContainer AddCursorContainer(Cursor cursor, int x, int y); + + /// + /// Add an icon container to the surface at the specified location + /// + /// Icon + /// int + /// int + /// IIconContainer IIconContainer AddIconContainer(Icon icon, int x, int y); + + /// + /// Add an image container to the surface at the specified location + /// + /// string + /// int + /// int + /// IBitmapContainer IBitmapContainer AddImageContainer(string filename, int x, int y); - ICursorContainer AddCursorContainer(string filename, int x, int y); + + /// + /// Add a cursor container to the surface at the specified location + /// + /// string + /// int + /// int + /// ICursorContainer + ICursorContainer AddCursorContainer(string filename, int x, int y); + + /// + /// Add an icon container to the surface at the specified location + /// + /// string + /// int + /// int + /// IIconContainer IIconContainer AddIconContainer(string filename, int x, int y); + + /// + /// Save all elements to the specified stream + /// + /// Stream + /// long with the size long SaveElementsToStream(Stream stream); + + /// + /// Load all the elements from the specified stream unto this surface + /// + /// Stream void LoadElementsFromStream(Stream stream); + + /// + /// Remove all elements which are selected + /// void RemoveSelectedElements(); + + /// + /// Cut all selected elements + /// void CutSelectedElements(); + + /// + /// Copy all selected elements onto the clipboard + /// void CopySelectedElements(); + + /// + /// Paste all elements from the clipboard unto the surface + /// void PasteElementFromClipboard(); + + /// + /// Create a clone from all selected elements + /// void DuplicateSelectedElements(); + + /// + /// de-select the specified element + /// + /// IDrawableContainer + /// bool void DeselectElement(IDrawableContainer container, bool generateEvents = true); + + /// + /// de-select all elements + /// void DeselectAllElements(); /// @@ -121,7 +253,17 @@ namespace Greenshot.Addons.Interfaces /// Should it be placed on the undo stack? void AddElements(IDrawableContainerList elements, bool makeUndoable = true); - void RemoveElements(IDrawableContainerList elements, bool makeUndoable = true); + /// + /// Remove the specified elements + /// + /// IDrawableContainerList + /// bool + void RemoveElements(IDrawableContainerList elements, bool makeUndoable = true); + + /// + /// Select the specified elements + /// + /// IDrawableContainerList void SelectElements(IDrawableContainerList elements); /// @@ -147,7 +289,15 @@ namespace Greenshot.Addons.Interfaces /// This returns false if the container is deleted but still in the undo stack bool IsOnSurface(IDrawableContainer container); - void Invalidate(Rectangle rectangleToInvalidate); + /// + /// Invalidate the surface, used for redrawing, for the specified rectangle + /// + /// Rectangle + void Invalidate(Rectangle rectangleToInvalidate); + + /// + /// Invalidate the surface, used for redrawing. + /// void Invalidate(); /// @@ -159,11 +309,31 @@ namespace Greenshot.Addons.Interfaces /// flag specifying if the deselect needs to generate an event void RemoveElement(IDrawableContainer elementToRemove, bool makeUndoable = true, bool invalidate = true, bool generateEvents = true); - void SendMessageEvent(object source, SurfaceMessageTyp messageType, string message); + /// + /// Send a message + /// + /// object + /// SurfaceMessageTyp + /// string + void SendMessageEvent(object source, SurfaceMessageTyp messageType, string message); + + /// + /// Apply an effect to the surface + /// + /// void ApplyBitmapEffect(IEffect effect); + + /// + /// Remove the cursor from the surface + /// void RemoveCursor(); - void MakeUndoable(IMemento memento, bool allowMerge); + /// + /// Make a change to the surface undoable. + /// + /// IMemento + /// bool + void MakeUndoable(IMemento memento, bool allowMerge); /// /// Use the supplied capture in the surface diff --git a/src/Greenshot.Addons/Interfaces/Plugin/HotKeyHandler.cs b/src/Greenshot.Addons/Interfaces/Plugin/HotKeyHandler.cs index e28e9d71c..585d55271 100644 --- a/src/Greenshot.Addons/Interfaces/Plugin/HotKeyHandler.cs +++ b/src/Greenshot.Addons/Interfaces/Plugin/HotKeyHandler.cs @@ -19,5 +19,8 @@ namespace Greenshot.Addons.Interfaces.Plugin { + /// + /// This defines a hotkey handler + /// public delegate void HotKeyHandler(); } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/Plugin/SurfaceOutputSettings.cs b/src/Greenshot.Addons/Interfaces/Plugin/SurfaceOutputSettings.cs index 992a9c0d6..056d116c7 100644 --- a/src/Greenshot.Addons/Interfaces/Plugin/SurfaceOutputSettings.cs +++ b/src/Greenshot.Addons/Interfaces/Plugin/SurfaceOutputSettings.cs @@ -33,7 +33,7 @@ namespace Greenshot.Addons.Interfaces.Plugin private bool _reduceColors; /// - /// Constructor + /// Default constructor /// /// IFileConfiguration public SurfaceOutputSettings(IFileConfiguration fileConfiguration) @@ -44,29 +44,62 @@ namespace Greenshot.Addons.Interfaces.Plugin ReduceColors = fileConfiguration?.OutputFileReduceColors ?? false; } - public SurfaceOutputSettings(IFileConfiguration fileConfiguration, OutputFormats format) : this(fileConfiguration) + /// + /// Constructor + /// + /// IFileConfiguration + /// OutputFormats + public SurfaceOutputSettings(IFileConfiguration fileConfiguration, OutputFormats format) : this(fileConfiguration) { Format = format; } - public SurfaceOutputSettings(IFileConfiguration fileConfiguration, OutputFormats format, int quality) : this(fileConfiguration, format) + /// + /// Constructor + /// + /// IFileConfiguration + /// OutputFormats + /// int + public SurfaceOutputSettings(IFileConfiguration fileConfiguration, OutputFormats format, int quality) : this(fileConfiguration, format) { JpgQuality = quality; } + /// + /// Constructor + /// + /// IFileConfiguration + /// OutputFormats + /// int + /// bool public SurfaceOutputSettings(IFileConfiguration fileConfiguration, OutputFormats format, int quality, bool reduceColors) : this(fileConfiguration, format, quality) { ReduceColors = reduceColors; } + /// + /// Format to output to + /// public OutputFormats Format { get; set; } + /// + /// Jpg-Quality to output with + /// public int JpgQuality { get; set; } + /// + /// Only save the background (capture) + /// public bool SaveBackgroundOnly { get; set; } + /// + /// List of effects to use on the output + /// public List Effects { get; } = new List(); + /// + /// Do the colors need to be reduced? + /// public bool ReduceColors { get diff --git a/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventHandler.cs b/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventHandler.cs index 205ff5868..3c79da037 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventHandler.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceDrawingModeEventHandler.cs @@ -19,5 +19,10 @@ namespace Greenshot.Addons.Interfaces { - public delegate void SurfaceDrawingModeEventHandler(object sender, SurfaceDrawingModeEventArgs e); + /// + /// This is the SurfaceDrawingModeEventHandler delegate + /// + /// object + /// SurfaceDrawingModeEventArgs + public delegate void SurfaceDrawingModeEventHandler(object sender, SurfaceDrawingModeEventArgs e); } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/SurfaceElementEventArgs.cs b/src/Greenshot.Addons/Interfaces/SurfaceElementEventArgs.cs index 6a41202e0..2ee487bfa 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceElementEventArgs.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceElementEventArgs.cs @@ -22,8 +22,14 @@ using Greenshot.Addons.Interfaces.Drawing; namespace Greenshot.Addons.Interfaces { + /// + /// This is the event arguments which contain surface elements + /// public class SurfaceElementEventArgs : EventArgs { + /// + /// The elements + /// public IDrawableContainerList Elements { get; set; } } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/SurfaceMessageEventArgs.cs b/src/Greenshot.Addons/Interfaces/SurfaceMessageEventArgs.cs index d2c31f63c..cab1bb0d6 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceMessageEventArgs.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceMessageEventArgs.cs @@ -21,12 +21,24 @@ using System; namespace Greenshot.Addons.Interfaces { + /// + /// This is the event arguments for a surface message + /// public class SurfaceMessageEventArgs : EventArgs { + /// + /// Type of the message + /// public SurfaceMessageTyp MessageType { get; set; } + /// + /// Message string + /// public string Message { get; set; } + /// + /// Surface which sent the event + /// public ISurface Surface { get; set; } } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/SurfaceMessageEventHandler.cs b/src/Greenshot.Addons/Interfaces/SurfaceMessageEventHandler.cs index cc52ff8a8..c12bbf52a 100644 --- a/src/Greenshot.Addons/Interfaces/SurfaceMessageEventHandler.cs +++ b/src/Greenshot.Addons/Interfaces/SurfaceMessageEventHandler.cs @@ -19,5 +19,10 @@ namespace Greenshot.Addons.Interfaces { - public delegate void SurfaceMessageEventHandler(object sender, SurfaceMessageEventArgs e); + /// + /// Delegate definition for the SurfaceMessageEventHandler + /// + /// object + /// SurfaceMessageEventArgs + public delegate void SurfaceMessageEventHandler(object sender, SurfaceMessageEventArgs e); } \ No newline at end of file diff --git a/src/Greenshot.Addons/Interfaces/VerticalAlignment.cs b/src/Greenshot.Addons/Interfaces/VerticalAlignment.cs index e013dcfda..50f8f8aeb 100644 --- a/src/Greenshot.Addons/Interfaces/VerticalAlignment.cs +++ b/src/Greenshot.Addons/Interfaces/VerticalAlignment.cs @@ -20,13 +20,21 @@ namespace Greenshot.Addons.Interfaces { /// - /// Alignment Enums for possitioning + /// Alignment for positioning /// - //public enum HorizontalAlignment {LEFT, CENTER, RIGHT}; public enum VerticalAlignment { - TOP, - CENTER, - BOTTOM + /// + /// Align at the top + /// + Top, + /// + /// Align in the center + /// + Center, + /// + /// Align at the bottom + /// + Bottom } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Resources/GreenshotResources.cs b/src/Greenshot.Addons/Resources/GreenshotResources.cs index 562ae3139..897391afc 100644 --- a/src/Greenshot.Addons/Resources/GreenshotResources.cs +++ b/src/Greenshot.Addons/Resources/GreenshotResources.cs @@ -28,7 +28,7 @@ using Greenshot.Gfx; namespace Greenshot.Addons.Resources { /// - /// Centralized storage of the icons & bitmaps + /// Centralized storage of the icons and bitmaps /// public class GreenshotResources { diff --git a/src/Greenshot.Addons/ViewModels/ExportNotificationViewModel.cs b/src/Greenshot.Addons/ViewModels/ExportNotificationViewModel.cs index 02bd07638..0b84e9f86 100644 --- a/src/Greenshot.Addons/ViewModels/ExportNotificationViewModel.cs +++ b/src/Greenshot.Addons/ViewModels/ExportNotificationViewModel.cs @@ -40,6 +40,15 @@ namespace Greenshot.Addons.ViewModels private readonly IConfigScreen _configScreen; private static readonly LogSource Log = new LogSource(); + /// + /// DI constructor + /// + /// IDestination + /// ExportInformation + /// ISurface + /// IWindowManager + /// Config + /// IConfigScreen public ExportNotificationViewModel( IDestination source, ExportInformation exportInformation, @@ -60,16 +69,34 @@ namespace Greenshot.Addons.ViewModels } } + /// + /// The greenshot icon + /// public ImageSource GreenshotIcon => GreenshotResources.Instance.GreenshotIconAsBitmapSource(); + /// + /// The export as ImageSource + /// public ImageSource ExportBitmapSource { get; } + /// + /// Which destination exported this? + /// public IDestination Source { get; } + /// + /// Information on the export + /// public ExportInformation Information { get; } + /// + /// Can we configure this? + /// public bool CanConfigure => _configScreen != null; + /// + /// Trigger the configuration + /// public void Configure() { if (!CanConfigure) diff --git a/src/Greenshot.Addons/ViewModels/FileConfigPartViewModel.cs b/src/Greenshot.Addons/ViewModels/FileConfigPartViewModel.cs index cf65b184e..a23bb56dc 100644 --- a/src/Greenshot.Addons/ViewModels/FileConfigPartViewModel.cs +++ b/src/Greenshot.Addons/ViewModels/FileConfigPartViewModel.cs @@ -34,10 +34,21 @@ namespace Greenshot.Addons.ViewModels private IDestinationFileConfiguration _destinationFileConfiguration; private bool _useOwnSettings; + /// + /// Provide the ICoreConfiguration to the view + /// public ICoreConfiguration CoreConfiguration { get; } + /// + /// Provide the IGreenshotLanguage to the view + /// public IGreenshotLanguage GreenshotLanguage { get; } + /// + /// DI constructor + /// + /// ICoreConfiguration + /// IGreenshotLanguage public FileConfigPartViewModel( ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage @@ -69,6 +80,9 @@ namespace Greenshot.Addons.ViewModels } } + /// + /// Provide the IFileConfiguration to the view + /// public IFileConfiguration FileConfiguration => DestinationFileConfiguration?.UseOwnSettings == true ? (IFileConfiguration)DestinationFileConfiguration diff --git a/src/Greenshot.Addons/ViewModels/UploadViewModel.cs b/src/Greenshot.Addons/ViewModels/UploadViewModel.cs index 5264e344a..b2ce1cecf 100644 --- a/src/Greenshot.Addons/ViewModels/UploadViewModel.cs +++ b/src/Greenshot.Addons/ViewModels/UploadViewModel.cs @@ -34,13 +34,21 @@ namespace Greenshot.Addons.ViewModels /// private CompositeDisposable _disposables; + /// + /// Provide the IGreenshotLanguage to the view + /// public IGreenshotLanguage GreenshotLanguage { get; } + /// + /// DI constructor + /// + /// public UploadViewModel(IGreenshotLanguage greenshotLanguage) { GreenshotLanguage = greenshotLanguage; } + /// protected override void OnActivate() { // Prepare disposables @@ -52,6 +60,7 @@ namespace Greenshot.Addons.ViewModels base.OnActivate(); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); diff --git a/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs b/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs index 594ac56ea..7cb5d5831 100644 --- a/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs +++ b/src/Greenshot.Gfx/FastBitmap/FastBitmapBase.cs @@ -30,18 +30,45 @@ namespace Greenshot.Gfx.FastBitmap /// public abstract unsafe class FastBitmapBase : IFastBitmapWithClip, IFastBitmapWithOffset { + /// + /// Index of the alpha data + /// protected const int PixelformatIndexA = 3; + /// + /// Index of the red data + /// protected const int PixelformatIndexR = 2; + /// + /// Index of the green data + /// protected const int PixelformatIndexG = 1; + /// + /// Index of the blue data + /// protected const int PixelformatIndexB = 0; + /// + /// Index of the red color data + /// public const int ColorIndexR = 0; + /// + /// Index of the green color data + /// public const int ColorIndexG = 1; + /// + /// Index of the blue color data + /// public const int ColorIndexB = 2; + /// + /// Index of the alpha color data + /// public const int ColorIndexA = 3; private const uint Seed = 0x9747b28c; + /// + /// Area which is covered by this fast bitmap + /// protected NativeRect Area; /// @@ -49,11 +76,23 @@ namespace Greenshot.Gfx.FastBitmap /// protected IBitmapWithNativeSupport Bitmap; + /// + /// Are the bits already locked? + /// protected bool BitsLocked; + /// + /// This contains the locked BitmapData + /// protected BitmapData BmData; + /// + /// Pointer to image data + /// protected byte* Pointer; - protected int Stride; /* bytes per pixel row */ + /// + /// bytes per pixel row + /// + protected int Stride; /// /// Constructor which stores the image and locks it when called @@ -75,23 +114,22 @@ namespace Greenshot.Gfx.FastBitmap Lock(); } - /// - /// If this is set to true, the bitmap will be disposed when disposing the IFastBitmap - /// + /// public bool NeedsDispose { get; set; } - public NativeRect Clip { get; set; } + /// + public NativeRect Clip { get; set; } - public bool InvertClip { get; set; } + /// + public bool InvertClip { get; set; } - public void SetResolution(float horizontal, float vertical) + /// + public void SetResolution(float horizontal, float vertical) { Bitmap.NativeBitmap.SetResolution(horizontal, vertical); } - /// - /// Return the size of the image - /// + /// public Size Size { get @@ -104,9 +142,7 @@ namespace Greenshot.Gfx.FastBitmap } } - /// - /// Return the width of the image - /// + /// public int Width { get @@ -115,9 +151,7 @@ namespace Greenshot.Gfx.FastBitmap } } - /// - /// Return the height of the image - /// + /// public int Height { get @@ -126,38 +160,28 @@ namespace Greenshot.Gfx.FastBitmap } } - /// - /// Return the left of the fastbitmap, this is also used as an offset - /// - public int Left + /// + public int Left { get { return 0; } set { ((IFastBitmapWithOffset) this).Left = value; } } - /// - /// Return the top of the fastbitmap, this is also used as an offset - /// - public int Top + /// + public int Top { get { return 0; } set { ((IFastBitmapWithOffset) this).Top = value; } } - /// - /// Return the right of the fastbitmap - /// - public int Right => Left + Width; + /// + public int Right => Left + Width; - /// - /// Return the bottom of the fastbitmap - /// - public int Bottom => Top + Height; + /// + public int Bottom => Top + Height; - /// - /// Returns the underlying bitmap, unlocks it and prevents that it will be disposed - /// - public IBitmapWithNativeSupport UnlockAndReturnBitmap() + /// + public IBitmapWithNativeSupport UnlockAndReturnBitmap() { if (BitsLocked) { @@ -167,12 +191,14 @@ namespace Greenshot.Gfx.FastBitmap return Bitmap; } - public virtual bool HasAlphaChannel => false; + /// + public virtual bool HasAlphaChannel => false; - /// - /// The public accessible Dispose - /// Will call the GarbageCollector to SuppressFinalize, preventing being cleaned twice - /// + /// + /// + /// The public accessible Dispose + /// Will call the GarbageCollector to SuppressFinalize, preventing being cleaned twice + /// public void Dispose() { Dispose(true); diff --git a/src/Greenshot.Gfx/Legacy/FixedAngleRoundBehavior.cs b/src/Greenshot.Gfx/Legacy/FixedAngleRoundBehavior.cs index d7fc6be38..ffe9d8f0e 100644 --- a/src/Greenshot.Gfx/Legacy/FixedAngleRoundBehavior.cs +++ b/src/Greenshot.Gfx/Legacy/FixedAngleRoundBehavior.cs @@ -19,18 +19,26 @@ namespace Greenshot.Gfx.Legacy { + /// + /// TODO: Comment + /// public class FixedAngleRoundBehavior : IDoubleProcessor { - private readonly double fixedAngle; + private readonly double _fixedAngle; + /// + /// Constructor + /// + /// double public FixedAngleRoundBehavior(double fixedAngle) { - this.fixedAngle = fixedAngle; + _fixedAngle = fixedAngle; } + /// public double Process(double angle) { - return fixedAngle; + return _fixedAngle; } } } \ No newline at end of file diff --git a/src/Greenshot.Gfx/UnmanagedBitmap.cs b/src/Greenshot.Gfx/UnmanagedBitmap.cs index c068ae590..662ed0d30 100644 --- a/src/Greenshot.Gfx/UnmanagedBitmap.cs +++ b/src/Greenshot.Gfx/UnmanagedBitmap.cs @@ -190,7 +190,11 @@ namespace Greenshot.Gfx { get { - return _nativeBitmap ??= new Bitmap(Width, Height, _stride, PixelFormat, _bits); + if (_nativeBitmap == null) + { + _nativeBitmap = new Bitmap(Width, Height, _stride, PixelFormat, _bits); + } + return _nativeBitmap; } } diff --git a/src/Greenshot/Destinations/ClipboardDestination.cs b/src/Greenshot/Destinations/ClipboardDestination.cs index 7c606ed5d..9eeb5ef7d 100644 --- a/src/Greenshot/Destinations/ClipboardDestination.cs +++ b/src/Greenshot/Destinations/ClipboardDestination.cs @@ -42,7 +42,7 @@ namespace Greenshot.Destinations private readonly ExportNotification _exportNotification; /// - /// DI Constructor + /// DI constructor /// /// ICoreConfiguration /// IGreenshotLanguage diff --git a/src/Greenshot/Helpers/EnvironmentInfo.cs b/src/Greenshot/Helpers/EnvironmentInfo.cs index 5da2b4a4a..e9608832a 100644 --- a/src/Greenshot/Helpers/EnvironmentInfo.cs +++ b/src/Greenshot/Helpers/EnvironmentInfo.cs @@ -32,12 +32,15 @@ using Dapplo.Windows.User32; namespace Greenshot.Helpers { /// - /// Description of EnvironmentInfo. + /// EnvironmentInfo provides information on the current environment /// public static class EnvironmentInfo { private static bool? _isWindows; + /// + /// Are we running on Windows? + /// public static bool IsWindows { get @@ -51,13 +54,22 @@ namespace Greenshot.Helpers } } - public static bool IsNet45OrNewer() + /// + /// Are we using Net45 or newer? + /// + /// bool + public static bool IsNet45OrNewer() { // Class "ReflectionContext" exists from .NET 4.5 onwards. return Type.GetType("System.Reflection.ReflectionContext", false) != null; } - public static string EnvironmentToString(bool newline) + /// + /// Create a description of the environment + /// + /// bool specifying if a newline or , nees to be used + /// string + public static string EnvironmentToString(bool newline) { var environment = new StringBuilder("Software version: " + Application.ProductVersion); environment.Append(" (" + OsInfo.Bits + " bit)"); @@ -154,7 +166,12 @@ namespace Greenshot.Helpers return environment.ToString(); } - public static string ExceptionToString(Exception ex) + /// + /// Create a nice string for the specified exception + /// + /// Exception + /// string + public static string ExceptionToString(Exception ex) { if (ex == null) { diff --git a/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs b/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs index f3112a4c1..582023c04 100644 --- a/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs +++ b/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs @@ -34,12 +34,12 @@ namespace Greenshot.Helpers.Mapi /// /// Author: Andrew Baker /// Datum: 10.03.2006 - /// Available from here + /// Available from here /// /// /// Represents an email message to be sent through MAPI. /// - public partial class MapiMailMessage : IDisposable + public class MapiMailMessage : IDisposable { private static readonly LogSource Log = new LogSource(); @@ -168,12 +168,17 @@ namespace Greenshot.Helpers.Mapi _manualResetEvent.Reset(); } - public void Dispose() + /// + public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } + /// + /// Actual dispose implementation + /// + /// bool protected virtual void Dispose(bool disposing) { if (!disposing) @@ -208,9 +213,9 @@ namespace Greenshot.Helpers.Mapi // Signal the creating thread (make the remaining code async) _manualResetEvent.Set(); - const int MAPI_DIALOG = 0x8; + const int mapiDialog = 0x8; //const int MAPI_LOGON_UI = 0x1; - var error = MapiHelperInterop.MAPISendMail(IntPtr.Zero, IntPtr.Zero, message, MAPI_DIALOG, 0); + var error = MapiHelperInterop.MAPISendMail(IntPtr.Zero, IntPtr.Zero, message, mapiDialog, 0); if (Files.Count > 0) { diff --git a/src/Greenshot/Helpers/WindowWrapper.cs b/src/Greenshot/Helpers/WindowWrapper.cs index 230fa650b..6cff481d2 100644 --- a/src/Greenshot/Helpers/WindowWrapper.cs +++ b/src/Greenshot/Helpers/WindowWrapper.cs @@ -22,13 +22,23 @@ using System.Windows.Forms; namespace Greenshot.Helpers { - public class WindowWrapper : IWin32Window + /// + /// This is a little wrapper around an IntPtr with a Window handle, it implements IWin32Window + /// + public class WindowWrapper : IWin32Window { - public WindowWrapper(IntPtr handle) + /// + /// Constructor + /// + /// IntPtr + public WindowWrapper(IntPtr handle) { Handle = handle; } + /// + /// The hwnd + /// public IntPtr Handle { get; } } } \ No newline at end of file diff --git a/src/Greenshot/Processors/TitleFixProcessor.cs b/src/Greenshot/Processors/TitleFixProcessor.cs index 9dcbc7c10..f6b5d9439 100644 --- a/src/Greenshot/Processors/TitleFixProcessor.cs +++ b/src/Greenshot/Processors/TitleFixProcessor.cs @@ -35,11 +35,14 @@ namespace Greenshot.Processors _coreConfiguration = coreConfiguration; } - public override string Designation => "TitleFix"; + /// + public override string Designation => "TitleFix"; - public override string Description => Designation; + /// + public override string Description => Designation; - public override bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails) + /// + public override bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails) { var changed = false; var title = captureDetails.Title; diff --git a/src/Greenshot/Ui/Configuration/ViewModels/CaptureConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/CaptureConfigViewModel.cs index 3365c4616..2e3887568 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/CaptureConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/CaptureConfigViewModel.cs @@ -56,7 +56,7 @@ namespace Greenshot.Ui.Configuration.ViewModels public IGreenshotLanguage GreenshotLanguage { get; } /// - /// DI Constructor + /// DI constructor /// /// ICoreConfiguration /// IConfigTranslations diff --git a/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs index 655093be3..e7c8d646b 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs @@ -58,7 +58,7 @@ namespace Greenshot.Ui.Configuration.ViewModels public IGreenshotLanguage GreenshotLanguage { get; } /// - /// DI Constructor + /// DI constructor /// /// ICoreConfiguration /// IConfigTranslations diff --git a/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs index 253ec8dfa..7abbdb21c 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs @@ -58,7 +58,7 @@ namespace Greenshot.Ui.Configuration.ViewModels public IGreenshotLanguage GreenshotLanguage { get; } /// - /// DI Constructor + /// DI constructor /// /// ICoreConfiguration /// IConfigTranslations diff --git a/src/Greenshot/Ui/Configuration/ViewModels/NetworkConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/NetworkConfigViewModel.cs index f986c0563..f5c37404e 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/NetworkConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/NetworkConfigViewModel.cs @@ -48,7 +48,7 @@ namespace Greenshot.Ui.Configuration.ViewModels public IGreenshotLanguage GreenshotLanguage { get; } /// - /// DI Constructor + /// DI constructor /// /// /// diff --git a/src/Greenshot/Ui/Configuration/ViewModels/OutputConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/OutputConfigViewModel.cs index f48c89c91..abe0e58cc 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/OutputConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/OutputConfigViewModel.cs @@ -52,7 +52,7 @@ namespace Greenshot.Ui.Configuration.ViewModels public FileConfigPartViewModel FileConfigPartViewModel { get; set; } /// - /// DI Constructor + /// DI constructor /// /// ICoreConfiguration /// IGreenshotLanguage diff --git a/src/Greenshot/Ui/Configuration/ViewModels/PrintConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/PrintConfigViewModel.cs index a9e4535a1..45e39911b 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/PrintConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/PrintConfigViewModel.cs @@ -46,7 +46,7 @@ namespace Greenshot.Ui.Configuration.ViewModels public IGreenshotLanguage GreenshotLanguage { get; } /// - /// DI Constructor + /// DI constructor /// /// ICoreConfiguration /// IGreenshotLanguage diff --git a/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs index 0d2647e85..5bbe0b35f 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs @@ -124,6 +124,7 @@ namespace Greenshot.Ui.Configuration.ViewModels _metroThemeManager.ChangeTheme(MetroConfiguration.Theme, MetroConfiguration.ThemeColor); } + /// public override void Initialize(IConfig config) { // Prepare disposables @@ -167,6 +168,7 @@ namespace Greenshot.Ui.Configuration.ViewModels base.Initialize(config); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose();