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

@ -45,14 +45,6 @@ namespace GreenshotPlugin.Core {
CoreConfig.PropertyChanged += OnIconSizeChanged;
}
/// <summary>
/// Simple global property to get the Greenshot host
/// </summary>
public static IGreenshotHost Host {
get;
set;
}
/// <summary>
/// Clear icon cache
/// </summary>
@ -220,11 +212,10 @@ namespace GreenshotPlugin.Core {
/// <summary>
/// Helper method to add a plugin MenuItem to the Greenshot context menu
/// </summary>
/// <param name="host">IGreenshotHost</param>
/// <param name="item">ToolStripMenuItem</param>
public static void AddToContextMenu(IGreenshotHost host, ToolStripMenuItem item) {
// Here we can hang ourselves to the main context menu!
ContextMenuStrip contextMenu = host.MainMenu;
public static void AddToContextMenu(ToolStripMenuItem item) {
// Here we can hang ourselves to the main context menu!
var contextMenu = SimpleServiceProvider.Current.GetInstance<ContextMenuStrip>();
bool addedItem = false;
// Try to find a separator, so we insert ourselves after it