Introduced a very simple "singleton" service-locator, which allowed for a removal of specific implementations which were very limited. With this it's easier to access dependencies.

This commit is contained in:
Krom, Robertus 2020-02-18 13:48:40 +01:00
commit 80d8f51fc5
53 changed files with 744 additions and 1230 deletions

View file

@ -29,6 +29,7 @@ namespace GreenshotWin10Plugin
/// <summary>
/// This is the Win10Plugin
/// </summary>
[Plugin("Win10", false)]
public class Win10Plugin : IGreenshotPlugin
{
public void Dispose()
@ -52,7 +53,7 @@ namespace GreenshotWin10Plugin
/// yields the windows 10 destinations if Windows 10 is detected
/// </summary>
/// <returns>IEnumerable with the destinations</returns>
public IEnumerable<IDestination> Destinations()
private IEnumerable<IDestination> Destinations()
{
if (!WindowsVersion.IsWindows10OrLater)
{
@ -62,19 +63,13 @@ namespace GreenshotWin10Plugin
yield return new Win10ShareDestination();
}
public IEnumerable<IProcessor> Processors()
{
yield break;
}
/// <summary>
/// <summary>
/// Implementation of the IGreenshotPlugin.Initialize
/// </summary>
/// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
/// <param name="myAttributes">My own attributes</param>
/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
public bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
public bool Initialize()
{
SimpleServiceProvider.Current.AddService(Destinations());
return true;
}