diff --git a/src/Greenshot.Plugin.Win10/Win10Plugin.cs b/src/Greenshot.Plugin.Win10/Win10Plugin.cs index 6b15ff3c5..ab0447faf 100644 --- a/src/Greenshot.Plugin.Win10/Win10Plugin.cs +++ b/src/Greenshot.Plugin.Win10/Win10Plugin.cs @@ -62,23 +62,32 @@ namespace Greenshot.Plugin.Win10 /// true if plugin is initialized, false if not (doesn't show) public bool Initialize() { - // Here we check if the build version of Windows is actually what we support - if (!WindowsVersion.IsWindows10BuildOrLater(17763)) + try { - Log.WarnFormat("No support for Windows build {0}", WindowsVersion.BuildVersion); + // Here we check if the build version of Windows is actually what we support + if (!WindowsVersion.IsWindows10BuildOrLater(17763)) + { + Log.WarnFormat("No support for Windows build {0}", WindowsVersion.BuildVersion); + return false; + } + + SimpleServiceProvider.Current.AddService(ToastNotificationService.Create()); + // Set this as IOcrProvider + SimpleServiceProvider.Current.AddService(new Win10OcrProvider()); + // Add the processor + SimpleServiceProvider.Current.AddService(new Win10OcrProcessor()); + + // Add the destinations + SimpleServiceProvider.Current.AddService(new Win10OcrDestination()); + SimpleServiceProvider.Current.AddService(new Win10ShareDestination()); + + return true; + } + catch (Exception e) + { + Log.Error("Failed to initialize Win10Plugin. Error: " + e.ToString(), e); return false; } - - SimpleServiceProvider.Current.AddService(ToastNotificationService.Create()); - // Set this as IOcrProvider - SimpleServiceProvider.Current.AddService(new Win10OcrProvider()); - // Add the processor - SimpleServiceProvider.Current.AddService(new Win10OcrProcessor()); - - // Add the destinations - SimpleServiceProvider.Current.AddService(new Win10OcrDestination()); - SimpleServiceProvider.Current.AddService(new Win10ShareDestination()); - return true; } public void Shutdown() @@ -86,4 +95,4 @@ namespace Greenshot.Plugin.Win10 // Nothing to shutdown } } -} \ No newline at end of file +}